Login  Register

Re: Issue with Java 3D under OpenJDK 7 / Mac OS X

Posted by Sven Gothel on Jun 21, 2012; 8:02am
URL: https://forum.jogamp.org/Issue-with-Java-3D-under-OpenJDK-7-Mac-OS-X-tp4025259p4025271.html

On 06/21/2012 05:24 AM, hharrison [via jogamp] wrote:
> Can you expand a little bit more on what the lifetime rules of the GLDrawable
> are that you think Java3d
> might be violating...I can have a look around and see if it is caching a
> GLDrawble anywhere....I have my
> suspicions it may be somewhere.

It's the lifecycle rules from NativeSurface, i.e.
native handles stay valid while it's locked.

You can never assume _same_ handles for the next locking period.

GLDrawable/GLContext lock it's NativeSurface at makeCurrent(..)
and release it w/ release() - 1 frame rendering.

Further more, if GLCanvas is offscreen, it may destroy and recreate:
  - jawtWindow
  - drawable
  - context
in case of resizing it. Sure this is required to match the offscreen
framebuffer w/ the window size.

During this recreation, dispose() and init() of the GLEventListeners
are being called and it's required to release/create all GLContext
resources.
The only way to avoid recreating these resources are by using a
primary GLContext which holds all data (textures, VBOs)
which then gets shared w/ the GLCanvas's GLContext.

We cannot add this functionality in GLCanvas in an automatic manner
due to the low level nature of our binding - and hence the transparent
exposed GLContext to the user.

Hence the Java3D usage of GLCanvas should take care of this recreation.
Sure - I don't know whether this is the culprit here,
but the exception (invalid drawable/window handle) points in that direction.

We know that the AWT GLCanvas is always offscreen on:
  - OSX >= 10.5.8 + Applets
  - OSX >= 10.5.8 + OpenJDK7
In both cases the now pbuffer (and future FBO) will be
composited by Apple's CALayer .. (performance?).

As Julien pointed out, using a direct NEWT window (not NewtCanvasAWT)
would allow you to use an onscreen window on all platforms.

However, since it's probably desired to also support Java3D w/ Applets
on OSX - the offscreen path might need to be handled.

I hope the above elaboration helps ..

@Harry: I guess it's time to drop your branch to our Jenkins build system.
        Please email me about the details,
        so I can start doing so this weekend.
        - Git repos
        - Build order
        - Required build magic ?

~Sven


signature.asc (910 bytes) Download Attachment