Posted by
Sven Gothel on
Sep 14, 2011; 5:22pm
URL: https://forum.jogamp.org/Context-sharing-regression-from-JSR231-to-Jogl-2-x-tp3332167p3336513.html
On Wednesday, September 14, 2011 12:35:28 PM TomN [via jogamp] wrote:
>
> Thanks for the feedback, guys. Changing the order of operations as you
> suggested makes the context sharing work, but I still have a crucial problem
> that I didn't have with Jogl 1.1.1.
>
> Allow me to elaborate on what I'm trying to achieve. I use a GLCanvas as my
> main drawable. The application uses a docking framework and offers a
> full-screen mode, both of which trigger changes to the component hierarchy
> surrounding the GLCanvas. By default, these changes cause all my
> application's texture objects to be lost due to the GL context being
> recreated. I successfully circumvented this with Jogl 1.1.1 by creating a
> pbuffer that shares its context with the GLCanvas. Since the pbuffer is not
> affected by the component hierarchy changes, it "protects" my texture
> objects for me.
Same as in unit test (line ~30 initShared())
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java;h=a37c43c58b6003eb838f93179f6af3c62547915d;hb=HEADThe above one uses shared VBO names, another test validates display lists (the ole gears).
>
> My current status with Jogl 2.x is that texture objects are valid in both
> the canvas and the pbuffer as long as I leave the canvas where it is. When
> the canvas reinitializes its context, however, it looks like the context
> sharing with the pbuffer is broken, and as a result my textures are still
> gone. Am I missing anything else?
Looks like some bug somewhere, yup.
>
> If it helps, here's the unit test code that I'm using to investigate these
> issues:
>
http://forum.jogamp.org/file/n3335436/GLCanvasContextSharingFullscreenTest.java> GLCanvasContextSharingFullscreenTest.java
Indeed it helps, thank you.
Your understanding of 'sharing' a context is just a bit wrong here.
A shared context must be registered at the GLAutoDrawable _before_ it's GLContext is
being created. It has to be this way, since you need to create the native context
while passing the shared one as an argument to make it share the shared one :)
(sorry for the complicated language)
As shown here:
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java;h=a37c43c58b6003eb838f93179f6af3c62547915d;hb=HEAD#l84 http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java;h=99e81af04b6eec8fec375aee979afe3c7fe2c544;hb=HEAD#l88The internal GLContextImpl constructor:
http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/jogamp/opengl/GLContextImpl.java;h=c3fcc50571f977fb2dada251233d8e0d788c9015;hb=HEAD#l115Hope this helps.
I would recommend the following:
- copy the above 'AWT Shared' unit test
- apply your texture functionality test to it
- test it .. and pls send back that test, so we have one for textures
>
> Thanks again,
> -- Tom
You are very welcome
~Sven