diff options
author | Sven Gothel <sgothel@jausoft.com> | 2013-08-16 03:39:25 +0200 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2013-08-16 03:39:25 +0200 |
commit | be0204ffe66bb9cb2918bfb01d0235fcaf0b3920 (patch) | |
tree | 1ec42a4131a5b48b857f047de3a63b40ad73bcf9 /src/jogl | |
parent | 65833bbcec423f9741116dc9b785e6954f2fcec7 (diff) |
Fix Bug 817 (2/2): GLContextImpl's getDefaultPixelDataType()/getDefaultPixelDataFormat() use defaults (fix)
GLContextImpl's getDefaultPixelDataType()/getDefaultPixelDataFormat()
uses default values if GL query fails.
Diffstat (limited to 'src/jogl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 8bc57fdf2..22240c246 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1925,23 +1925,27 @@ public abstract class GLContextImpl extends GLContext { if(!pixelDataEvaluated) { synchronized(this) { if(!pixelDataEvaluated) { + boolean ok = false; /* if(isGL2GL3() && 3 == components) { pixelDataInternalFormat=GL.GL_RGB; pixelDataFormat=GL.GL_RGB; - pixelDataType = GL.GL_UNSIGNED_BYTE; - } else */ if(isGLES2Compatible() || isExtensionAvailable(GLExtensions.OES_read_format)) { + pixelDataType = GL.GL_UNSIGNED_BYTE; + ok = true; + } else */ if( isGLES2Compatible() || isExtensionAvailable(GLExtensions.OES_read_format) ) { final int[] glImplColorReadVals = new int[] { 0, 0 }; gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_FORMAT, glImplColorReadVals, 0); gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_TYPE, glImplColorReadVals, 1); // pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB; pixelDataFormat = glImplColorReadVals[0]; pixelDataType = glImplColorReadVals[1]; - } else { + ok = 0 != pixelDataFormat && 0 != pixelDataType; + } + if( !ok ) { // RGBA read is safe for all GL profiles // pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB; pixelDataFormat=GL.GL_RGBA; pixelDataType = GL.GL_UNSIGNED_BYTE; - } + } // TODO: Consider: // return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; pixelDataEvaluated = true; |