Bug 378 - TextureData incorrectly requires GL context
Summary: TextureData incorrectly requires GL context
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 2
Hardware: All all
: P3 normal
Assignee: Sven Gothel
: 380 (view as bug list)
Depends on:
Reported: 2009-08-27 05:04 CEST by Sven Gothel
Modified: 2010-03-24 22:38 CET (History)
1 user (show)

See Also:
SCM Refs:
8b8e270788b50636e48ee17cc9e5fc8f29d44f5c def4bf0d2f6ff9bf77418d26807bdcb187a3b033
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-24 07:51:51 CET

---- Reported by qwerty999 2009-08-27 17:04:52 ----

Hi, in JOGL2 there is an issue with creating a TextureData. TextureData for some reason requires the GL 
context to be available. But the whole point of having TextureData was to separate texture preparation 
from the GL context. 

You can see for instance in the class AWTTextureData.java one method requires an open GL context 
simply to determine the GLProfile.

GLProfile glp = GLContext.getCurrentGL().getGLProfile();
if (glp.isGL2()) { ... }

So, calling a method via the TextureIO class such as:

TextureIO.newTextureData(myFile, false, null);

will throw this exception:

Exception in thread "main" javax.media.opengl.GLException: No OpenGL context current on this thread
        at javax.media.opengl.GLContext.getCurrentGL(GLContext.java:159)
        at com.sun.opengl.util.texture.awt.AWTTextureData.createFromImage(AWTTextureData.java:173)
        at com.sun.opengl.util.texture.awt.AWTTextureData.<init>(AWTTextureData.java:102)
        at com.sun.opengl.util.texture.TextureIO.newTextureDataImpl(TextureIO.java:765)
        at com.sun.opengl.util.texture.TextureIO.newTextureData(TextureIO.java:180)

--- Bug imported by sgothel@jausoft.com 2010-03-24 07:51 EDT  ---

This bug was previously known as _bug_ 378 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=378
Comment 1 Sven Gothel 2010-03-24 09:16:52 CET
*** Bug 380 has been marked as a duplicate of this bug. ***
Comment 2 Sven Gothel 2010-03-24 18:54:55 CET
Moved to JOGL2 ..
Comment 3 Sven Gothel 2010-03-24 22:30:04 CET
git: 8b8e270788b50636e48ee17cc9e5fc8f29d44f5c

Solution: Pending data initialization if GL dependencies, see git log.

Also: Added JUNIT tests (compile and run) in JOGL.
Comment 4 Sven Gothel 2010-03-24 22:38:56 CET
git: def4bf0d2f6ff9bf77418d26807bdcb187a3b033

forgot to check-in the tests ..