Bug 206

Summary: glTexImage2D fails on external context
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P3    
Version: 1   
Hardware: All   
OS: linux   
Type: DEFECT SCM Refs:
Workaround: ---

Description Sven Gothel 2010-03-24 07:48:30 CET


---- Reported by gmueckl 2006-02-22 18:10:16 ----

When using JOGL with an external context (the context has an on screen 
drawable provided by SWT) glTexImage2D fails. The relevant part of the stack 
backtrace is included. 
 
javax.media.opengl.GLException: Context not current 
	at 
com.sun.opengl.impl.x11.X11GLContext.getPlatformExtensionsString(X11GLContext.java:212) 
	at 
com.sun.opengl.impl.FunctionAvailabilityCache.initAvailableExtensions(FunctionAvailabilityCache.java:116) 
	at 
com.sun.opengl.impl.FunctionAvailabilityCache.isExtensionAvailable(FunctionAvailabilityCache.java:104) 
	at 
com.sun.opengl.impl.GLContextImpl.isExtensionAvailable(GLContextImpl.java:314) 
	at 
com.sun.opengl.impl.x11.X11GLContext.isExtensionAvailable(X11GLContext.java:256) 
	at com.sun.opengl.impl.GLImpl.isExtensionAvailable(GLImpl.java:27851) 
	at com.sun.opengl.impl.GLImpl.checkBufferObject(GLImpl.java:27992) 
	at 
com.sun.opengl.impl.GLImpl.checkUnpackPBODisabled(GLImpl.java:28012) 
	at com.sun.opengl.impl.GLImpl.glTexImage2D(GLImpl.java:19578) 
 
Please note that glTexImage2D is indeed called on the correct (and cureent) 
context. Because of problems with generating the GLImpl code I cannot have a 
look at how you've attempted to optimize texture loading, although the intent 
is obvious from the stack backtrace. 
 
To me this looks a lot like JOGL fails to catch that exception and therefore 
is unable to fall back to a plain call of glTexImage2D. If this is what 
happens, then this behaviour is clearly a bug.



---- Additional Comments From gmueckl 2006-02-22 18:12:48 ----

I forgot to mention that this happens with the nightly build from 2006-02-22. 



---- Additional Comments From kbr 2006-02-22 20:45:52 ----

It looks like there has been a bug basically forever in the X11ExternalGLContext
code where the mostRecentDisplay was never set, causing failure of extension
queries. I find it hard to believe that this could have been broken for this
long, but it's pretty clear a bug was there. It's been fixed in the JOGL tree
and will show up in the nightly build of 2/23. Please retest with that build or
later and verify the fix. Please also double-check that the application is
calling makeCurrent()/release() on the external GLContext, which is required
even though it will not change the actual underlying OpenGL context. FYI, this
had nothing to do with texturing specifically.




---- Additional Comments From gmueckl 2006-02-23 12:35:47 ----

OK, there are no more exceptions with the new version, so it appears to be 
fixed. Thanks! 
 



---- Additional Comments From kbr 2006-02-23 15:06:30 ----

Marking bug as fixed.




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

This bug was previously known as _bug_ 206 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=206