aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-22 03:29:09 +0100
committerSven Gothel <[email protected]>2012-02-22 03:29:09 +0100
commita5e0661540b7dc6c10112ab8c0d3bc41a7b03080 (patch)
tree49ee0e7388554477e768545e17cf45ab2892989b /src/jogl/classes/javax
parent3bf2d88a4af2d207c141f93d4aaa0e88ac4057a5 (diff)
Minor GL/GLContext additions / cleanups (GL_BGRA, isNPOTTextureAvailable())
- Subsume GL_EXT_texture_format_BGRA8888 -> GL, Added GLContext.isTextureFormatBGRA8888Available() - Movied generic isNPOTTextureAvailable() from GL -> GLContext, used by GL (desktop), added simplified impl. in GLES1/GLES2 (false/true)
Diffstat (limited to 'src/jogl/classes/javax')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java13
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java4
2 files changed, 14 insertions, 3 deletions
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;