Hi,
I’m having a similar issue occurring with JOGL2. In JOGL1.1.1 you could call newTextureData without worrying GLContext to get a TextureData, and then in the GL display loop decide when to convert it to a Texture, or update a Texture, etc. Which I thought was the reason to have TextureData in the first place.
However in JOGL2 even trying to create a newTextureData will return this execption;
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.spi.awt.IIOTextureProvider.newTextureData(IIOTextureProvider.java:69)
at com.sun.opengl.util.texture.TextureIO.newTextureDataImpl(TextureIO.java:765)
at com.sun.opengl.util.texture.TextureIO.newTextureData(TextureIO.java:180)
Looking at the source code the single place where an openGL context is needed is in this if statement (inside of AWTTextureData.java):
GLProfile glp = GLContext.getCurrentGL().getGLProfile();
if (glp.isGL2()) { ... }
Anyhow, maybe I’m confused about this, but I thought the point in having the TextureData object was so that you could load in images/data without having an active context. And in JOGL2 you need to be in the GL thread to load the background data.
Maybe there is need for a constructor like:
AWTTextureData(int internalFormat, int pixelFormat, boolean mipmap, BufferedImage image, GLProfile profile)
or
AWTTextureData(int internalFormat, int pixelFormat, boolean mipmap, BufferedImage image, String profileStr)
?
-spiraljetty