summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java66
1 files changed, 37 insertions, 29 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index b947bd693..bd2d21cc9 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -107,6 +107,9 @@ public abstract class GLContextImpl extends GLContext {
protected GLDrawableImpl drawable;
protected GLDrawableImpl drawableRead;
+ private volatile boolean pixelDataEvaluated;
+ private int /* pixelDataInternalFormat, */ pixelDataFormat, pixelDataType;
+
protected GL gl;
protected static final Object mappedContextTypeObjectLock;
@@ -175,6 +178,8 @@ public abstract class GLContextImpl extends GLContext {
boundFBOTarget[0] = 0; // draw
boundFBOTarget[1] = 0; // read
}
+
+ pixelDataEvaluated = false;
super.resetStates();
}
@@ -1807,40 +1812,43 @@ public abstract class GLContextImpl extends GLContext {
@Override
public int getDefaultPixelDataType() {
- if(!pixelDataTypeEvaluated) {
- synchronized(this) {
- if(!pixelDataTypeEvaluated) {
- evalPixelDataType();
- pixelDataTypeEvaluated = true;
- }
- }
- }
+ evalPixelDataType();
return pixelDataType;
}
- private volatile boolean pixelDataTypeEvaluated = false;
- int /* pixelDataInternalFormat, */ pixelDataFormat, pixelDataType;
+ @Override
+ public int getDefaultPixelDataFormat() {
+ evalPixelDataType();
+ return pixelDataFormat;
+ }
private final void evalPixelDataType() {
- /* 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)) {
- 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 {
- // 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;
+ if(!pixelDataEvaluated) {
+ synchronized(this) {
+ if(!pixelDataEvaluated) {
+ /* 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)) {
+ 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 {
+ // 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;
+ }
+ }
+ }
}
//----------------------------------------------------------------------