jOGL support

Started by rolz, April 09, 2005, 09:22:28 PM

Previous topic - Next topic

Would you like to see jOGL support in jPCT ?

Yes
4 (66.7%)
No
2 (33.3%)

Total Members Voted: 6

Voting closed: April 09, 2005, 09:22:28 PM

rolz

Helge,

Is there a way to add jOGL bindings to jPCT  ?

It would be very nice to have hardware 3d that could draw its contents into a native peer (awt or swing panel). Using glass panes along with this should give more control over 2D UI elements which lwjgl binding lacks.
Regards,
Andrei

EgonOlsen

The newest version of LWJGL has an AWTGLCanvas that should make AWT/Swing-integration possible. I haven't tried it yet and i don't know if or how it would fit into jPCT. I would prefer over adding support for jogl though.

rolz

Helge,

Just looked at
http://lwjgl.org/forum/viewtopic.php?p=7121

Looks like a feature that would fit jPCT nicely.
Regards,
Andrei

EgonOlsen

Quote from: "rolz"Looks like a feature that would fit jPCT nicely.
I think so. But i haven't got a look on how it's done yet. I'll do so, when i have the time and maybe add it in one way or the other.
BTW: I accidently edited your post instead of quoting it... :oops: I hope, i've restored it correctly...

EgonOlsen

FYI: I had a look at it...the AWTGLCanvas itself is drop dead simple to use...if you start from scratch with using it in mind! Of course, you have to do the GL-stuff in the AWTEvent-Thread now and that's the problem. jPCT isn't build that way and adding support for it requires a whole new layer between the IRenderer and the actual polygon drawing introducing some queues to queue GL-stuff until it can be handled by the AWTEvent-Thread. Anyway, i'm working on that and i already have a pre-alpha version of it running...it's not funny and i'm sure that some more pitfalls are lying ahead... :?

rolz

Helge,

I've modified JPCT's GLRenderer to support drawing GL context inside AWT panel. I will gladly share the code when this solution will be elegant enough.

yes, the main problem is that 3D logic should be done insinde AWT eventdispatch thread. This could be ok for some POC solution, but for compatibility with the existing JPCT code it would be nice to have some wrapper aroung AWTGLCanvas that will allow modifying the World outside the AWT thread - in the same way JPCT works now.
Regards,
Andrei

EgonOlsen

Quote from: "rolz"...but for compatibility with the existing JPCT code it would be nice to have some wrapper aroung AWTGLCanvas that will allow modifying the World outside the AWT thread - in the same way JPCT works now.
That's what i'm trying to do and what already seems to work to a degree. It should remain possible to switch renderers at will, so this is a must to me. Could happen that some seldom used stuff (like grabbing the rendered image from the graphics card) won't work with the AWTGLCanvas or at least not in it's current state...we'll see...

EgonOlsen

A preview version is out (have a look at the news section). Had to do some crazy things to get jPCT working with the AWTGLCanvas and i'm not sure how stable this thing is. That's why i call it "preview" (to avoid calling it "beta"...:wink: ). I used a special test case and the car example for testing it, and both worked just fine, so there's hope that it isn't totally bugged at least...

rolz

Thanks, I am eager to use it when i have a couple of spare days from my day work. ;-)
Regards,
Andrei

EgonOlsen

When using the new AWTGLRenderer, it helps performance to set Config.glVertexArrays to true, because it reduces load on the command queue. It usually is a good idea to use this setting in OpenGL mode, but especially when using this renderer.
Funny thing about the renderer is, that jPCT gets multithreaded for free when using it. Scene management, transformations and stuff happen in one thread while the actual painting happens in another (the dispatch event thread). This is noticable on a HT/dual cpu machine: Where an application uses around 50% (i.e. one cpu) when using the GLRenderer, it starts to use up to 95% when using the AWTGLRenderer. Would be interesting to see the performance of this on a real dual cpu setup, because hyperthreading doesn't really cut it...

rolz

Helge,

How do i use this new renderer ? I did not found any legal way to access canvas  :(
Regards,
Andrei

rolz

Forget it,

just found the thing ;)
Regards,
Andrei

EgonOlsen

I've just uploaded a slightly newer version that fixes a problem in AWTGLRenderer.dispose() and adds a listener interface (IPaintListener) that can be used as a hook into the AWTGLRenderer (for correctly counting fps for example).