aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java13
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java8
5 files changed, 22 insertions, 11 deletions
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 );