Poll

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

Author Topic: jOGL support  (Read 5368 times)

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
jOGL support
« on: April 09, 2005, 09:22:28 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jOGL support
« Reply #1 on: April 10, 2005, 12:55:31 am »
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.

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
AWTGLCanvas
« Reply #2 on: April 10, 2005, 10:40:07 am »
Helge,

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

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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: AWTGLCanvas
« Reply #3 on: April 12, 2005, 07:43:42 am »
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...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jOGL support
« Reply #4 on: April 14, 2005, 11:48:05 pm »
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... :?

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
Thanks
« Reply #5 on: April 15, 2005, 06:50:39 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Thanks
« Reply #6 on: April 16, 2005, 10:39:26 pm »
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...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jOGL support
« Reply #7 on: April 19, 2005, 09:26:05 pm »
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...

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
Cool feature.
« Reply #8 on: April 20, 2005, 07:56:30 am »
Thanks, I am eager to use it when i have a couple of spare days from my day work. ;-)
Regards,
Andrei

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jOGL support
« Reply #9 on: April 20, 2005, 04:48:39 pm »
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...

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
a question
« Reply #10 on: April 22, 2005, 02:45:38 pm »
Helge,

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

Offline rolz

  • float
  • ****
  • Posts: 280
  • Technocrat
    • View Profile
Oohh ; )
« Reply #11 on: April 22, 2005, 03:01:34 pm »
Forget it,

just found the thing ;)
Regards,
Andrei

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
jOGL support
« Reply #12 on: April 22, 2005, 04:13:21 pm »
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).