diff options
author | Michael Bien <[email protected]> | 2010-04-22 23:27:41 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-04-22 23:27:41 +0200 |
commit | d5b392ac40d8f7c65e76aca5673748cf24b8a1e8 (patch) | |
tree | 6aefdbde469d8620c65b82174db1ad043e433c66 | |
parent | ca6818d87ee86b2cc9961e47ad9f899e1fd90f78 (diff) | |
parent | 012fca06f2539db232f0183f72187ec2f8ca54f5 (diff) |
Merge branch 'master' of github.com:mbien/jogl
11 files changed, 178 insertions, 177 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java index 2c3f60d32..1c0707c57 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java @@ -46,6 +46,7 @@ package com.jogamp.opengl.impl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.GLException; import java.nio.*; @@ -125,7 +126,7 @@ public class Mipmap { if( !legalFormat( format ) || !legalType( type ) ) { return( GLU.GLU_INVALID_ENUM ); } - if( format == GL2.GL_STENCIL_INDEX ) { + if( format == GL2GL3.GL_STENCIL_INDEX ) { return( GLU.GLU_INVALID_ENUM ); } if( !isLegalFormatForPackedPixelType( format, type ) ) { @@ -137,18 +138,18 @@ public class Mipmap { public static boolean legalFormat( int format ) { switch( format ) { case( GL2.GL_COLOR_INDEX ): - case( GL2.GL_STENCIL_INDEX ): - case( GL2.GL_DEPTH_COMPONENT ): - case( GL2.GL_RED ): - case( GL2.GL_GREEN ): - case( GL2.GL_BLUE ): - case( GL2.GL_ALPHA ): - case( GL2.GL_RGB ): - case( GL2.GL_RGBA ): - case( GL2.GL_LUMINANCE ): - case( GL2.GL_LUMINANCE_ALPHA ): - case( GL2.GL_BGR ): - case( GL2.GL_BGRA ): + case( GL2GL3.GL_STENCIL_INDEX ): + case( GL2GL3.GL_DEPTH_COMPONENT ): + case( GL2GL3.GL_RED ): + case( GL2GL3.GL_GREEN ): + case( GL2GL3.GL_BLUE ): + case( GL2GL3.GL_ALPHA ): + case( GL2GL3.GL_RGB ): + case( GL2GL3.GL_RGBA ): + case( GL2GL3.GL_LUMINANCE ): + case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL2GL3.GL_BGR ): + case( GL2GL3.GL_BGRA ): return( true ); default: return( false ); @@ -158,25 +159,25 @@ public class Mipmap { public static boolean legalType( int type ) { switch( type ) { case( GL2.GL_BITMAP ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2GL3.GL_BYTE ): + case( GL2GL3.GL_UNSIGNED_BYTE ): + case( GL2GL3.GL_SHORT ): + case( GL2GL3.GL_UNSIGNED_SHORT ): + case( GL2GL3.GL_INT ): + case( GL2GL3.GL_UNSIGNED_INT ): + case( GL2GL3.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): return( true ); default: return( false ); @@ -186,18 +187,18 @@ public class Mipmap { public static boolean isTypePackedPixel( int type ) { assert( legalType( type ) ); - if( type == GL2.GL_UNSIGNED_BYTE_3_3_2 || - type == GL2.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2.GL_UNSIGNED_SHORT_5_6_5 || - type == GL2.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2.GL_UNSIGNED_SHORT_4_4_4_4 || - type == GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2.GL_UNSIGNED_SHORT_5_5_5_1 || - type == GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV || - type == GL2.GL_UNSIGNED_INT_8_8_8_8 || - type == GL2.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2.GL_UNSIGNED_INT_2_10_10_10_REV ) { + if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || + type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || + 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 ) { return( true ); } return( false ); @@ -210,23 +211,23 @@ public class Mipmap { } // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB - if( (type == GL2.GL_UNSIGNED_BYTE_3_3_2 || type == GL2.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2.GL_UNSIGNED_SHORT_5_6_5 || type == GL2.GL_UNSIGNED_SHORT_5_6_5_REV ) - & format != GL2.GL_RGB ) { + if( (type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) + & format != GL2GL3.GL_RGB ) { return( false ); } // 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & // 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT - if( ( type == GL2.GL_UNSIGNED_SHORT_4_4_4_4 || - type == GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2.GL_UNSIGNED_SHORT_5_5_5_1 || - type == GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV || - type == GL2.GL_UNSIGNED_INT_8_8_8_8 || - type == GL2.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2.GL_UNSIGNED_INT_2_10_10_10_REV ) && - (format != GL2.GL_RGBA && format != GL2.GL_BGRA) ) { + if( ( type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || + 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) ) { return( false ); } return( true ); @@ -272,27 +273,27 @@ public class Mipmap { assert( heightAtLevelOne > 0 ); // does width x height at level 1 & all their mipmaps fit? - if( target == GL2.GL_TEXTURE_2D || target == GL2.GL_PROXY_TEXTURE_2D ) { - proxyTarget = GL2.GL_PROXY_TEXTURE_2D; + if( target == GL2GL3.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { + proxyTarget = GL2GL3.GL_PROXY_TEXTURE_2D; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); - } else if( (target == GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || - (target == GL2.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || - (target == GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || - (target == GL2.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || - (target == GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || - (target == GL2.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { - proxyTarget = GL2.GL_PROXY_TEXTURE_CUBE_MAP; + } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || + (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { + proxyTarget = GL2GL3.GL_PROXY_TEXTURE_CUBE_MAP; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); } else { - assert( target == GL2.GL_TEXTURE_1D || target == GL2.GL_PROXY_TEXTURE_1D ); - proxyTarget = GL2.GL_PROXY_TEXTURE_1D; - gl.getGL2().glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne, + assert( target == GL2GL3.GL_TEXTURE_1D || target == GL2GL3.GL_PROXY_TEXTURE_1D ); + proxyTarget = GL2GL3.GL_PROXY_TEXTURE_1D; + gl.getGL2GL3().glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne, 0, format, type, null ); } - if(gl.isGL2()) { - gl.getGL2().glGetTexLevelParameteriv( proxyTarget, 1, GL2.GL_TEXTURE_WIDTH, proxyWidth, 0 ); + if(gl.isGL2GL3()) { + gl.getGL2GL3().glGetTexLevelParameteriv( proxyTarget, 1, GL2GL3.GL_TEXTURE_WIDTH, proxyWidth, 0 ); } else { proxyWidth[0] = 0; } @@ -324,7 +325,7 @@ public class Mipmap { } } int[] maxsize = new int[1]; - gl.glGetIntegerv( GL2.GL_MAX_TEXTURE_SIZE, maxsize , 0); + gl.glGetIntegerv( GL2GL3.GL_MAX_TEXTURE_SIZE, maxsize , 0); // clamp user's texture sizes to maximum sizes, if necessary newWidth[0] = nearestPower( width ); if( newWidth[0] > maxsize[0] ) { @@ -355,13 +356,13 @@ public class Mipmap { assert( depthAtLevelOne > 0 ); // does width x height x depth at level 1 & all their mipmaps fit? - if( target == GL2.GL_TEXTURE_3D || target == GL2.GL_PROXY_TEXTURE_3D ) { - proxyTarget = GL2.GL_PROXY_TEXTURE_3D; - gl.getGL2().glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne, + if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { + proxyTarget = GL2GL3.GL_PROXY_TEXTURE_3D; + gl.getGL2GL3().glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, depthAtLevelOne, 0, format, type, null ); } - if(gl.isGL2()) { - gl.getGL2().glGetTexLevelParameteriv( proxyTarget, 1, GL2.GL_TEXTURE_WIDTH, proxyWidth, 0 ); + if(gl.isGL2GL3()) { + gl.getGL2GL3().glGetTexLevelParameteriv( proxyTarget, 1, GL2GL3.GL_TEXTURE_WIDTH, proxyWidth, 0 ); } else { proxyWidth[0] = 0; } @@ -388,30 +389,30 @@ public class Mipmap { // Return the number of elements per grtoup of a specified gromat // If the type is packedpixels then answer is 1 - if( type == GL2.GL_UNSIGNED_BYTE_3_3_2 || - type == GL2.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2.GL_UNSIGNED_SHORT_5_6_5 || - type == GL2.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2.GL_UNSIGNED_SHORT_4_4_4_4 || - type == GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2.GL_UNSIGNED_SHORT_5_5_5_1 || - type == GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV || - type == GL2.GL_UNSIGNED_INT_8_8_8_8 || - type == GL2.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2.GL_UNSIGNED_INT_2_10_10_10_REV ) { + if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || + type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || + 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 ) { return( 1 ); } // Types are not packed pixels so get elements per group switch( format ) { - case( GL2.GL_RGB ): - case( GL2.GL_BGR ): + case( GL2GL3.GL_RGB ): + case( GL2GL3.GL_BGR ): return( 3 ); - case( GL2.GL_LUMINANCE_ALPHA ): + case( GL2GL3.GL_LUMINANCE_ALPHA ): return( 2 ); - case( GL2.GL_RGBA ): - case( GL2.GL_BGRA ): + case( GL2GL3.GL_RGBA ): + case( GL2GL3.GL_BGRA ): return( 4 ); default: return( 1 ); @@ -423,27 +424,27 @@ public class Mipmap { switch( type ) { case( GL2.GL_BITMAP ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_BYTE ): + case( GL2GL3.GL_UNSIGNED_BYTE ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): return( 1 ); - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_SHORT ): + case( GL2GL3.GL_UNSIGNED_SHORT ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): return( 2 ); - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): - case( GL2.GL_FLOAT ): + case( GL2GL3.GL_INT ): + case( GL2GL3.GL_UNSIGNED_INT ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2GL3.GL_FLOAT ): return( 4 ); default: return( 4 ); @@ -451,7 +452,7 @@ public class Mipmap { } public static boolean is_index( int format ) { - return( format == GL2.GL_COLOR_INDEX || format == GL2.GL_STENCIL_INDEX ); + return( format == GL2.GL_COLOR_INDEX || format == GL2GL3.GL_STENCIL_INDEX ); } /* Compute memory required for internal packed array of data of given type and format. */ @@ -483,67 +484,67 @@ public class Mipmap { public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { int[] a = new int[1]; - gl.glGetIntegerv( GL2.GL_UNPACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_LSB_FIRST, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2.GL_UNPACK_SWAP_BYTES, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0); psm.setPackSkipPixels( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_LSB_FIRST, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0); psm.setPackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2.GL_PACK_SWAP_BYTES, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_SWAP_BYTES, a, 0); psm.setPackSwapBytes( ( a[0] == 1 ) ); } public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { int[] a = new int[1]; - gl.glGetIntegerv( GL2.GL_UNPACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_LSB_FIRST, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2.GL_UNPACK_SWAP_BYTES, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_IMAGES, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_IMAGES, a, 0); psm.setUnpackSkipImages( a[0] ); - gl.glGetIntegerv( GL2.GL_UNPACK_IMAGE_HEIGHT, a, 0); + gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0); psm.setUnpackImageHeight( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_SKIP_PIXELS, a, 0 ); + gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0 ); psm.setPackSkipPixels( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_LSB_FIRST, a, 0 ); + gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0 ); psm.setPackLsbFirst( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2.GL_PACK_SWAP_BYTES, a, 0 ); + gl.glGetIntegerv( GL2GL3.GL_PACK_SWAP_BYTES, a, 0 ); psm.setPackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2.GL_PACK_SKIP_IMAGES, a, 0 ); + gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_IMAGES, a, 0 ); psm.setPackSkipImages( a[0] ); - gl.glGetIntegerv( GL2.GL_PACK_IMAGE_HEIGHT, a, 0 ); + gl.glGetIntegerv( GL2GL3.GL_PACK_IMAGE_HEIGHT, a, 0 ); psm.setPackImageHeight( a[0] ); } @@ -574,8 +575,8 @@ public class Mipmap { if( !isLegalFormatForPackedPixelType( format, typeout ) ) { return( GLU.GLU_INVALID_OPERATION ); } - beforeimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthin, heightin, format, GL2.GL_UNSIGNED_SHORT ) )); - afterimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthout, heightout, format, GL2.GL_UNSIGNED_SHORT ) )); + beforeimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthin, heightin, format, GL2GL3.GL_UNSIGNED_SHORT ) )); + afterimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthout, heightout, format, GL2GL3.GL_UNSIGNED_SHORT ) )); if( beforeimage == null || afterimage == null ) { return( GLU.GLU_OUT_OF_MEMORY ); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java index 8b8bb46fa..89e293665 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java @@ -51,7 +51,7 @@ public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext public int getOffscreenContextPixelDataType() { GL gl = getGL(); - return gl.isGL2()?GL2.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; + return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; } public int getOffscreenContextReadBuffer() { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java index e90672a1d..52a892b70 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java @@ -80,7 +80,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext { DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); GL gl = getGL(); - boolean rect = gl.isGL2() && capabilities.getPbufferRenderToTextureRectangle(); + boolean rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle(); if (rect) { if (!gl.isExtensionAvailable("GL_EXT_texture_rectangle")) { System.err.println("MacOSXPbufferCGLContext: WARNING: GL_EXT_texture_rectangle extension not " + diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java index b02cea03e..afdc40dbb 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -112,7 +112,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities(); GLProfile glProfile = capabilities.getGLProfile(); int renderTarget; - if (glProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) { + if (glProfile.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle()) { renderTarget = GL2.GL_TEXTURE_RECTANGLE; } else { int w = getNextPowerOf2(getWidth()); @@ -132,7 +132,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available"); } */ - if(glProfile.isGL2()) { + if(glProfile.isGL2GL3()) { switch (capabilities.getRedBits()) { case 16: internalFormat = GL2.GL_RGBA_FLOAT16_APPLE; break; case 32: internalFormat = GL2.GL_RGBA_FLOAT32_APPLE; break; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java index b0524bcd9..a9e02e11f 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java @@ -101,7 +101,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext { // Initialize render-to-texture support if requested GL gl = getGL(); rtt = capabilities.getPbufferRenderToTexture(); - rect = gl.isGL2() && capabilities.getPbufferRenderToTextureRectangle(); + rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle(); if (rtt) { if (DEBUG) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java index 306a711bd..bea953ee9 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java @@ -54,7 +54,7 @@ public class X11OffscreenGLXContext extends X11GLXContext { public int getOffscreenContextPixelDataType() { GL gl = getGL(); - return gl.isGL2()?GL2.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; + return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1; } public int getOffscreenContextReadBuffer() { diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index 21f359f52..c7e845953 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -221,7 +221,7 @@ public class ShaderUtil { v = true; } shaderCompilerAvailable = new Boolean(v); - } else if( gl.isGL2() || gl.isGL2ES2() ) { + } else if( gl.isGL2ES2() ) { shaderCompilerAvailable = new Boolean(true); } else { throw new GLException("Invalid OpenGL profile"); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index 5ef96eeaf..57ac0d45a 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -487,7 +487,7 @@ public class Texture { } if (!done && preferTexRect(gl) && !isPOT && - haveTexRect(gl) && !data.isDataCompressed() && gl.isGL2()) { + haveTexRect(gl) && !data.isDataCompressed() && !gl.isGL3() && !gl.isGLES()) { // GL_ARB_texture_rectangle does not work for compressed textures if (DEBUG) { System.err.println("Using GL_ARB_texture_rectangle preferentially on this hardware"); @@ -514,7 +514,7 @@ public class Texture { done = true; } - if (!done && haveTexRect(gl) && !data.isDataCompressed() && gl.isGL2()) { + if (!done && haveTexRect(gl) && !data.isDataCompressed() && !gl.isGL3() && !gl.isGLES()) { // GL_ARB_texture_rectangle does not work for compressed textures if (DEBUG) { System.err.println("Using GL_ARB_texture_rectangle"); @@ -1013,10 +1013,10 @@ public class Texture { int[] skipRows = { 0 }; int[] skipPixels = { 0 }; gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, align, 0); // save alignment - if(gl.isGL2()) { - gl.glGetIntegerv(GL2.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length - gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows - gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels + if(gl.isGL2GL3()) { + gl.glGetIntegerv(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length + gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows + gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels } gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, data.getAlignment()); if (DEBUG && VERBOSE) { @@ -1028,10 +1028,10 @@ public class Texture { System.out.println("width = " + width); System.out.println("height = " + height); } - if(gl.isGL2()) { - gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, rowlen); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, srcy); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, srcx); + if(gl.isGL2GL3()) { + gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowlen); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, srcy); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, srcx); } else { if ( rowlen!=0 && rowlen!=width && srcy!=0 && srcx!=0 ) { @@ -1044,10 +1044,10 @@ public class Texture { data.getPixelFormat(), data.getPixelType(), buffer); gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, align[0]); // restore alignment - if(gl.isGL2()) { - gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels + if(gl.isGL2GL3()) { + gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length + gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows + gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels } } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp index d1eca7c69..6e6e4ab04 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp @@ -308,8 +308,8 @@ public class TGAImage { GL gl = GLContext.getCurrentGL(); if (header.pixelDepth() == 24) { bpp=3; - if(gl.isGL2()) { - format = GL2.GL_BGR; + if(gl.isGL2GL3()) { + format = GL2GL3.GL_BGR; } else { format = GL.GL_RGB; swapBGR(tmpData, rawWidth, header.height(), bpp); @@ -318,8 +318,8 @@ public class TGAImage { assert header.pixelDepth() == 32; bpp=4; - if(gl.isGL2()) { - format = GL2.GL_BGRA; + if(gl.isGL2GL3()) { + format = GL2GL3.GL_BGRA; } else { format = GL.GL_RGBA; swapBGR(tmpData, rawWidth, header.height(), bpp); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase index 8575f553d..16ba538b5 100755 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase @@ -310,8 +310,8 @@ public class TGAImage { GL gl = GLContext.getCurrentGL(); if (header.pixelDepth() == 24) { bpp=3; - if(gl.isGL2()) { - format = GL2.GL_BGR; + if(gl.isGL2GL3()) { + format = GL2GL3.GL_BGR; } else { format = GL.GL_RGB; swapBGR(tmpData, rawWidth, header.height(), bpp); @@ -320,8 +320,8 @@ public class TGAImage { assert header.pixelDepth() == 32; bpp=4; - if(gl.isGL2()) { - format = GL2.GL_BGRA; + if(gl.isGL2GL3()) { + format = GL2GL3.GL_BGRA; } else { format = GL.GL_RGBA; swapBGR(tmpData, rawWidth, header.height(), bpp); diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index e5b499af9..2709dd506 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -378,6 +378,10 @@ public abstract class GLContext { return ctxMajorVersion>=1 && CTX_PROFILE_COMPAT==(ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_ES)); } + public final boolean isGL2GL3() { + return isGL2() || isGL3(); + } + public final boolean isGLES1() { return ctxMajorVersion==1 && CTX_PROFILE_ES==(ctxOptions & CTX_PROFILE_ES); } @@ -395,11 +399,7 @@ public abstract class GLContext { } public final boolean isGL2ES2() { - return isGL2() || isGL3() || isGLES2() ; - } - - public final boolean isGL2GL3() { - return isGL2() || isGL3(); + return isGL2GL3() || isGLES2() ; } public final boolean hasGLSL() { |