diff options
10 files changed, 34 insertions, 16 deletions
diff --git a/make/config/jogl/gl-common-extensions.cfg b/make/config/jogl/gl-common-extensions.cfg index 194d45346..51edd9edd 100644 --- a/make/config/jogl/gl-common-extensions.cfg +++ b/make/config/jogl/gl-common-extensions.cfg @@ -86,6 +86,7 @@ RenameExtensionIntoCore GL_EXT_texture_type_2_10_10_10_REV RenameExtensionIntoCore GL_NV_draw_buffers RenameExtensionIntoCore GL_NV_fbo_color_attachments RenameExtensionIntoCore GL_EXT_packed_float +RenameExtensionIntoCore GL_EXT_texture_format_BGRA8888 # A mess w/ the ES2 definition .. sadly # RenameExtensionIntoCore GL_EXT_texture_storage diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java index 8e7a9fb37..0a8e90171 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-common.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -35,11 +35,6 @@ return _context.isExtensionAvailable(glExtensionName); } - public boolean isNPOTTextureAvailable() { - return isGL3() || isGLES2Compatible() || isExtensionAvailable(GL_ARB_texture_non_power_of_two); - } - private static final String GL_ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two"; - public Object getExtension(String extensionName) { // At this point we don't expose any extensions using this mechanism return null; diff --git a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java index 08b981af7..33b0f1326 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java @@ -120,3 +120,6 @@ throw new GLException("Not a GLES2 implementation"); } + public boolean isNPOTTextureAvailable() { + return _context.isNPOTTextureAvailable(); + } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 54bb37ce8..abb10cee0 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -58,6 +58,10 @@ public final boolean hasGLSL() { return false; } +public boolean isNPOTTextureAvailable() { + return false; +} + public final GL4bc getGL4bc() throws GLException { throw new GLException("Not a GL4bc implementation"); } diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java index b009d935b..195124d79 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -62,6 +62,10 @@ public final boolean hasGLSL() { return true; } +public boolean isNPOTTextureAvailable() { + return true; +} + public final GL4bc getGL4bc() throws GLException { throw new GLException("Not a GL4bc implementation"); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index 4ab603576..32391c650 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -431,7 +431,7 @@ public class GLBuffers extends Buffers { break; case GL.GL_RGBA: case GL2GL3.GL_RGBA_INTEGER: - case GL2GL3.GL_BGRA: + case GL.GL_BGRA: case GL2GL3.GL_BGRA_INTEGER: case GL2.GL_ABGR_EXT: elements = 4; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java index 39ec74b97..ad96a9939 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java @@ -180,7 +180,7 @@ public class AWTTextureData extends TextureData { if (glp.isGL2GL3()) { switch (image.getType()) { case BufferedImage.TYPE_INT_RGB: - pixelFormat = GL2GL3.GL_BGRA; + pixelFormat = GL.GL_BGRA; pixelType = GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV; rowLength = scanlineStride; alignment = 4; @@ -188,7 +188,7 @@ public class AWTTextureData extends TextureData { setupLazyCustomConversion(image); break; case BufferedImage.TYPE_INT_ARGB_PRE: - pixelFormat = GL2GL3.GL_BGRA; + pixelFormat = GL.GL_BGRA; pixelType = GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV; rowLength = scanlineStride; alignment = 4; @@ -254,7 +254,7 @@ public class AWTTextureData extends TextureData { setupLazyCustomConversion(image); break; case BufferedImage.TYPE_USHORT_555_RGB: - pixelFormat = GL2GL3.GL_BGRA; + pixelFormat = GL.GL_BGRA; pixelType = GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV; rowLength = scanlineStride; alignment = 2; diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 894f44b9f..b74cfb939 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -547,7 +547,18 @@ public abstract class GLContext { public final boolean hasGLSL() { return isGL2ES2() ; } - + + /** Note: The GL impl. may return a const value, ie {@link GLES2#isNPOTTextureAvailable()} always returns <code>true</code>. */ + public boolean isNPOTTextureAvailable() { + return isGL3() || isGLES2Compatible() || isExtensionAvailable(GL_ARB_texture_non_power_of_two); + } + private static final String GL_ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two"; + + public boolean isTextureFormatBGRA8888Available() { + return isGL2GL3() || + isExtensionAvailable("GL_EXT_texture_format_BGRA8888") || + isExtensionAvailable("GL_IMG_texture_format_BGRA8888") ; + } public final boolean isGL4bc() { return ctxMajorVersion>=4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 4ccd3c97c..cd9136e76 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -864,13 +864,13 @@ public void reshape(int x, int y, int width, int height) { switch (awtFormat) { case BufferedImage.TYPE_3BYTE_BGR: glFormat = GL2.GL_BGR; - glType = GL2.GL_UNSIGNED_BYTE; + glType = GL.GL_UNSIGNED_BYTE; readBackBytes = ByteBuffer.allocate(readBackWidthInPixels * readBackHeightInPixels * 3); break; case BufferedImage.TYPE_INT_RGB: case BufferedImage.TYPE_INT_ARGB: - glFormat = GL2.GL_BGRA; + glFormat = GL.GL_BGRA; glType = getGLPixelType(); readBackInts = IntBuffer.allocate(readBackWidthInPixels * readBackHeightInPixels); break; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java index f38b62e37..b74d0a6b8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java @@ -149,7 +149,7 @@ public class Mipmap { case( GL2GL3.GL_LUMINANCE ): case( GL2GL3.GL_LUMINANCE_ALPHA ): case( GL2GL3.GL_BGR ): - case( GL2GL3.GL_BGRA ): + case( GL.GL_BGRA ): return( true ); default: return( false ); @@ -227,7 +227,7 @@ public class Mipmap { type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) && - (format != GL2GL3.GL_RGBA && format != GL2GL3.GL_BGRA) ) { + (format != GL.GL_RGBA && format != GL.GL_BGRA) ) { return( false ); } return( true ); @@ -411,8 +411,8 @@ public class Mipmap { return( 3 ); case( GL2GL3.GL_LUMINANCE_ALPHA ): return( 2 ); - case( GL2GL3.GL_RGBA ): - case( GL2GL3.GL_BGRA ): + case( GL.GL_RGBA ): + case( GL.GL_BGRA ): return( 4 ); default: return( 1 ); |