diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/jogl/classes/jogamp/opengl/glu/mipmap | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/glu/mipmap')
26 files changed, 1185 insertions, 1151 deletions
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java index 81a99beab..337d93b80 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java @@ -46,9 +46,15 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; + import jogamp.opengl.Debug; + import com.jogamp.common.nio.Buffers; + import java.nio.*; import java.io.*; @@ -65,9 +71,9 @@ public class BuildMipmap { public BuildMipmap() { } - public static int gluBuild1DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int widthPowerOf2, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { + public static int gluBuild1DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int widthPowerOf2, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { int newwidth; int level, levels; ShortBuffer newImage = null; @@ -75,9 +81,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer imageTemp = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 ); @@ -90,40 +96,40 @@ public class BuildMipmap { Mipmap.retrieveStoreModes( gl, psm ); try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format, - GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes was set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = userLevel; level <= levels; level++ ) { if( newImage_width == newwidth ) { // user newimage for this level if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, format, - GL2.GL_UNSIGNED_SHORT, newImage ); + GL.GL_UNSIGNED_SHORT, newImage ); } } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth, 1, format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth, 1, format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -136,26 +142,26 @@ public class BuildMipmap { newImage_width = newwidth; if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, - format, GL2.GL_UNSIGNED_SHORT, newImage ); + format, GL.GL_UNSIGNED_SHORT, newImage ); } } if( newwidth > 1 ) { newwidth /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, ByteBuffer data ) { - int newwidth[] = new int[1]; - int newheight[] = new int[1]; + public static int bitmapBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int newwidth[] = new int[1]; + final int newheight[] = new int[1]; int level, levels; ShortBuffer newImage = null; int newImage_width; @@ -163,9 +169,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer tempImage = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); Mipmap.retrieveStoreModes( gl, psm ); @@ -179,8 +185,8 @@ public class BuildMipmap { try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height, - format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -189,30 +195,30 @@ public class BuildMipmap { Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes is set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level < levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, - newImage_height, 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + newImage_height, 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -227,7 +233,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } if( newheight[0] > 1 ) { newwidth[0] /= 2; @@ -236,38 +242,38 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int widthPowerOf2, int heightPowerOf2, - int format, int type, int userLevel, int baseLevel, int maxLevel, - ByteBuffer data ) { // PointerWrapper data + public static int gluBuild2DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int widthPowerOf2, final int heightPowerOf2, + final int format, final int type, final int userLevel, final int baseLevel, final int maxLevel, + final ByteBuffer data ) { // PointerWrapper data int newwidth; int newheight; int level, levels; - int usersImage; + final int usersImage; ByteBuffer srcImage = null; ByteBuffer dstImage = null; ByteBuffer tempImage = null; - int newImage_width; - int newImage_height; - short[] SWAP_IMAGE = null; + final int newImage_width; + final int newImage_height; + final short[] SWAP_IMAGE = null; int memReq; - int maxsize; + final int maxsize; int cmpts; int mark=-1; boolean myswap_bytes; int groups_per_line, element_size, group_size; int rowsize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 ); @@ -310,9 +316,9 @@ public class BuildMipmap { mark = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; data.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); level = userLevel; @@ -324,11 +330,11 @@ public class BuildMipmap { gl.glTexImage2D( target, level, internalFormat, width, height, 0, format, type, data ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } int nextWidth = newwidth / 2; @@ -345,97 +351,97 @@ public class BuildMipmap { try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, width, height, data, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -462,36 +468,36 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } // level userLevel+1 is in srcImage; level userLevel already saved @@ -500,113 +506,113 @@ public class BuildMipmap { memReq = Mipmap.image_size( newwidth, newheight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } data.position( mark ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): ScaleInternal.scale_internal_uint( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): ScaleInternal.scale_internal_int( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): ScaleInternal.scale_internal_float( cmpts, width, height, data, newwidth, newheight, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract332(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract233rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract5551(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1555rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1010102(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract2101010rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; @@ -634,36 +640,36 @@ public class BuildMipmap { memReq = Mipmap.image_size( nextWidth, nextHeight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -671,7 +677,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { srcImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); @@ -691,63 +697,63 @@ public class BuildMipmap { srcImage.rewind(); dstImage.rewind(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, newwidth, newheight, srcImage, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -768,7 +774,7 @@ public class BuildMipmap { newheight /= 2; } // compute amount to pad per row if any - int rowPad = rowsize % psm.getUnpackAlignment(); + final int rowPad = rowsize % psm.getUnpackAlignment(); // should row be padded if( rowPad == 0 ) { @@ -788,21 +794,21 @@ public class BuildMipmap { } } else { // compute length of new row in bytes, including padding - int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; + final int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; int ii, jj; - int dstTrav; - int srcTrav; + final int dstTrav; + final int srcTrav; // allocate new image for mipmap of size newRowLength x newheight ByteBuffer newMipmapImage = null; try { newMipmapImage = ByteBuffer.allocateDirect( newRowLength * newheight ); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } srcImage.rewind(); @@ -828,19 +834,19 @@ public class BuildMipmap { } } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target, - int components, int width, int height, int format, int type, ByteBuffer data ) { - int[] newwidth = new int[1]; - int[] newheight = new int[1]; + public static int fastBuild2DMipmaps( final GL gl, final PixelStorageModes psm, final int target, + final int components, final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int[] newwidth = new int[1]; + final int[] newheight = new int[1]; int level, levels; ByteBuffer newImage; int newImage_width; @@ -848,7 +854,7 @@ public class BuildMipmap { ByteBuffer otherImage; ByteBuffer imageTemp; int memReq; - int maxsize; + final int maxsize; int cmpts; Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, @@ -876,12 +882,12 @@ public class BuildMipmap { int elements_per_line; int start; int iter; - int iter2; + final int iter2; int i, j; try { - newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL2.GL_UNSIGNED_BYTE ) ); - } catch( OutOfMemoryError err ) { + newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL.GL_UNSIGNED_BYTE ) ); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -907,29 +913,29 @@ public class BuildMipmap { } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 1 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 1 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level <= levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { // use newImage for this level newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_BYTE ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_BYTE ); try { otherImage = Buffers.newDirectByteBuffer( memReq ); - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -942,7 +948,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } if( newwidth[0] > 1 ) { newwidth[0] /= 2; @@ -951,30 +957,30 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( 0 ); } - public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int depth, int widthPowerOf2, int heightPowerOf2, - int depthPowerOf2, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { + public static int gluBuild3DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int widthPowerOf2, final int heightPowerOf2, + final int depthPowerOf2, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { int newWidth; int newHeight; int newDepth; int level, levels; ByteBuffer usersImage; ByteBuffer srcImage, dstImage, tempImage; - int newImageWidth; - int newImageHeight; - int newImageDepth; + final int newImageWidth; + final int newImageHeight; + final int newImageDepth; int memReq; - int maxSize; + final int maxSize; int cmpts; int mark=-1; @@ -982,7 +988,7 @@ public class BuildMipmap { int groupsPerLine, elementSize, groupSize; int rowsPerImage, imageSize; int rowSize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 && depth >= 1 ); @@ -1041,11 +1047,11 @@ public class BuildMipmap { psm.getUnpackSkipImages() * imageSize; usersImage.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0 ); level = userLevel; @@ -1056,13 +1062,13 @@ public class BuildMipmap { 0, format, type, usersImage ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } int nextWidth = newWidth / 2; @@ -1082,44 +1088,44 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, @@ -1129,7 +1135,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1139,7 +1145,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1149,7 +1155,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1159,7 +1165,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1169,7 +1175,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1179,7 +1185,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1189,53 +1195,53 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1268,38 +1274,38 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1309,38 +1315,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1371,38 +1377,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_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( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.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( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -1410,7 +1416,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { usersImage.position( mark ); gl.getGL2().glTexImage3D( target, level, internalFormat, width, height, depth, @@ -1419,7 +1425,7 @@ public class BuildMipmap { level++; for( ; level <= levels; level++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1429,7 +1435,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1439,7 +1445,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1449,7 +1455,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1459,7 +1465,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1469,7 +1475,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1479,7 +1485,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1489,51 +1495,51 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1563,22 +1569,22 @@ public class BuildMipmap { 0, format, type, usersImage ); } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } private static final int TARGA_HEADER_SIZE = 18; - private static void writeTargaFile(String filename, ByteBuffer data, - int width, int height) { + private static void writeTargaFile(final String filename, final ByteBuffer data, + final int width, final int height) { try { - FileOutputStream fos = new FileOutputStream(new File(filename)); - ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); + final FileOutputStream fos = new FileOutputStream(new File(filename)); + final ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); header.put(0, (byte) 0).put(1, (byte) 0); header.put(2, (byte) 2); // uncompressed type header.put(12, (byte) (width & 0xFF)); // width @@ -1590,7 +1596,7 @@ public class BuildMipmap { fos.write(data.array()); data.clear(); fos.close(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java index 0c155ff96..fe9c15e60 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java @@ -57,7 +57,7 @@ public class Extract1010102 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1010102 implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f; + extractComponents[0] = ( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0x00000003 ) ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java index 5208ea537..d619502be 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java @@ -57,7 +57,7 @@ public class Extract1555rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1555rev implements Extract { // 01111100,00000000 == 0x7C00 // 10000000,00000000 == 0x8000 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15); + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x003E ) >> 5 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x7C00 ) >> 10) / 31.0f; + extractComponents[3] = ( ushort & 0x8000 ) >> 15; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00011111 == 0x001F // 00000011,11100000 == 0x03E0 // 01111100,00000000 == 0x7C00 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java index 1bf8abcc3..9d00badcb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java @@ -57,7 +57,7 @@ public class Extract2101010rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract2101010rev implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; + extractComponents[0] = ( ( uint & 0x000003FF ) ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java index c86b39e63..3bc797518 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java @@ -57,18 +57,18 @@ public class Extract233rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0x07) ) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f; - extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0x07) ) / 7.0f; + extractComponents[1] = ((ubyte & 0x38) >> 3) / 7.0f; + extractComponents[2] = ((ubyte & 0xC0) >> 6) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java index 706f0c3f2..93983f1d7 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java @@ -57,18 +57,18 @@ public class Extract332 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0xe0) >> 5) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f; - extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0xe0) >> 5) / 7.0f; + extractComponents[1] = ((ubyte & 0x1c) >> 2) / 7.0f; + extractComponents[2] = ((ubyte & 0x03)) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java index 182d66ce2..323ca7f1a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java @@ -57,7 +57,7 @@ public class Extract4444 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444 implements Extract { // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[0] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0x000F ) ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java index 52ecdc17c..267286519 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java @@ -57,7 +57,7 @@ public class Extract4444rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444rev implements Extract { // 00001111,00000000 == 0x0F00 // 11110000,00000000 == 0xF000 - extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[0] = ( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java index 21f53aa1d..ee33ca7c1 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java @@ -57,7 +57,7 @@ public class Extract5551 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract5551 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) ); + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) ); } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java index 7408c45b2..d63943a2e 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java @@ -57,7 +57,7 @@ public class Extract565 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565 implements Extract { // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0x001F ) ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11111000,00000000 == 0xF800 // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java index adaafa7ea..cfea71487 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java @@ -57,7 +57,7 @@ public class Extract565rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565rev implements Extract { // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00111111 == 0x001F // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java index be155d578..f6fe92c82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java @@ -57,7 +57,7 @@ public class Extract8888 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[0] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[1] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[3] = ( ( uint & 0x000000FF ) ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java index 294e60e12..942f6d88a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java @@ -57,7 +57,7 @@ public class Extract8888rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888rev implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[0] = ( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[1] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[3] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java index 1dd8bff8a..09d70e492 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java @@ -57,7 +57,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer data ) { + public double extract( final boolean isSwap, final ByteBuffer data ) { float f = 0; if( isSwap ) { f = Mipmap.GLU_SWAP_4_BYTES( data.getInt() ); @@ -69,7 +69,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 1.0); data.asFloatBuffer().put( index, (float)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java index dcbe52a40..e9b021413 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java @@ -57,14 +57,14 @@ public class ExtractSByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer sbyte ) { - byte b = sbyte.get(); + public double extract( final boolean isSwap, final ByteBuffer sbyte ) { + final byte b = sbyte.get(); assert( b <= 127 ); return( b ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { data.position( index ); data.put( (byte)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java index 547bd944a..9532fdade 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java @@ -57,7 +57,7 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { int i = 0; if( isSwap ) { i = Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < Integer.MAX_VALUE); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java index 7dc172976..6e14f89c0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java @@ -57,7 +57,7 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { short s = 0; if( isSwap ) { s = Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 32768.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java index 3e933811c..d9db0019b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java @@ -57,14 +57,14 @@ public class ExtractUByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ubyte ) { - int i = 0x000000FF & ubyte.get(); + public double extract( final boolean isSwap, final ByteBuffer ubyte ) { + final int i = 0x000000FF & ubyte.get(); assert( i <= 255 ); return( i ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 256.0); data.position( index ); data.put( (byte)value ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java index 1c34828b3..3e4ad41c2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java @@ -57,7 +57,7 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { long i = 0; if( isSwap ) { i = 0xFFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 0xFFFFFFFF); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java index 8e0d25c42..b121c1054 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java @@ -57,7 +57,7 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { int i = 0; if( isSwap ) { i = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 65536.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java index 184c5fda8..100c6ba1f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java @@ -57,8 +57,8 @@ public class HalveImage { private static final int BOX4 = 4; private static final int BOX8 = 8; - public static void halveImage( int components, int width, int height, - ShortBuffer datain, ShortBuffer dataout ) { + public static void halveImage( final int components, final int width, final int height, + final ShortBuffer datain, final ShortBuffer dataout ) { int i, j, k; int newwidth, newheight; int delta; @@ -92,9 +92,9 @@ public class HalveImage { } } - public static void halveImage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halveImage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; int s; @@ -134,9 +134,9 @@ public class HalveImage { } } - public static void halve1Dimage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -170,10 +170,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -203,12 +203,12 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, int element_size, - int ysize, int group_size ) { + public static void halveImage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, final int element_size, + final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; byte temp = (byte)0; @@ -245,9 +245,9 @@ public class HalveImage { } } - public static void halve1Dimage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = width / 2; int src = 0; @@ -276,10 +276,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assert only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -304,12 +304,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; // handle case where there is only 1 column/row @@ -365,9 +366,9 @@ public class HalveImage { } } - public static void halve1Dimage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -384,7 +385,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -402,10 +403,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -414,7 +415,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -438,12 +439,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; short temp = (short)0; // handle case where there is only 1 column/row @@ -472,7 +474,7 @@ public class HalveImage { temp += datain.getShort(); temp += 2; temp /= 4; - dataout.put( (short)temp ); + dataout.put( temp ); t += element_size; } t += group_size; @@ -483,8 +485,8 @@ public class HalveImage { for( i = 0; i < newheight; i++ ) { for( j = 0; j < newwidth; j++ ) { for( k = 0; k < components; k++ ) { - short b; - int buf; + final short b; + final int buf; datain.position( t ); temp = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); datain.position( t + group_size ); @@ -505,9 +507,9 @@ public class HalveImage { } } - public static void halve1Dimage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -524,7 +526,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -542,10 +544,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -554,7 +556,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -578,12 +580,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; double temp = 0; @@ -644,9 +647,9 @@ public class HalveImage { } } - public static void halve1Dimage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -663,7 +666,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -681,10 +684,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -693,7 +696,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -717,12 +720,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; @@ -786,9 +790,9 @@ public class HalveImage { } } - public static void halve1Dimage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -805,7 +809,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -823,10 +827,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -835,7 +839,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -859,12 +863,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; float temp = 0.0f; // handle case where there is only 1 column/row @@ -921,9 +926,9 @@ public class HalveImage { } } - public static void halve1Dimage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -940,7 +945,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -958,10 +963,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -970,7 +975,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -994,9 +999,9 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); halve1DimagePackedPixel( components, extract, width, height, datain, dataout, @@ -1005,16 +1010,16 @@ public class HalveImage { } int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; datain.position( src ); @@ -1046,9 +1051,9 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight ); } - public static void halve1DimagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halve1DimagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -1066,8 +1071,8 @@ public class HalveImage { // one horizontal row with possible pad bytes for( jj = 0; jj < halfWidth; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; datain.position( src ); @@ -1088,7 +1093,7 @@ public class HalveImage { // skip over to next group of 2 src += pixelSizeInBytes + pixelSizeInBytes; } - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); src += padBytes; assert( src == rowSizeInBytes ); @@ -1102,8 +1107,8 @@ public class HalveImage { // average two at a time for( jj = 0; jj < halfHeight; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; // average two at a time, instead of four datain.position( src ); @@ -1129,16 +1134,16 @@ public class HalveImage { } } - public static void halveImagePackedPixelSlice( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixelSlice( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1148,8 +1153,8 @@ public class HalveImage { assert( depth >= 2 ); for( ii = 0; ii < halfDepth; ii++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX2][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX2][4]; int cc; dataIn.position( src ); @@ -1178,8 +1183,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1199,7 +1204,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1212,8 +1217,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1233,7 +1238,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1244,16 +1249,16 @@ public class HalveImage { } } - public static void halveImageSlice( int components, ExtractPrimitive extract, int width, - int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImageSlice( final int components, final ExtractPrimitive extract, final int width, + final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1265,8 +1270,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { int cc; for( cc = 0; cc < components; cc++ ) { - double[] totals = new double[4]; - double[][] extractTotals = new double[BOX2][4]; + final double[] totals = new double[4]; + final double[][] extractTotals = new double[BOX2][4]; int kk; dataIn.position( src ); @@ -1281,7 +1286,7 @@ public class HalveImage { for( kk = 0; kk < BOX2; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX2; + totals[cc] /= BOX2; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1301,8 +1306,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1321,7 +1326,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1343,8 +1348,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1364,7 +1369,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1381,10 +1386,10 @@ public class HalveImage { } } - public static void halveImage3D( int components, ExtractPrimitive extract, - int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImage3D( final int components, final ExtractPrimitive extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { assert( depth > 1 ); // horizontal/vertical/onecolumn slice viewed from top @@ -1399,11 +1404,11 @@ public class HalveImage { int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { @@ -1412,8 +1417,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX8][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX8][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1437,7 +1442,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX8; + totals[cc] /= BOX8; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1457,10 +1462,10 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight * halfDepth * components ); } - public static void halveImagePackedPixel3D( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel3D( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { if( depth == 1 ) { assert( 1 <= width && 1 <= height ); @@ -1476,18 +1481,18 @@ public class HalveImage { } int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; // 4 is max components - float extractTotals[][] = new float[BOX8][4]; + final float totals[] = new float[4]; // 4 is max components + final float extractTotals[][] = new float[BOX8][4]; int cc; dataIn.position( src ); @@ -1514,7 +1519,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (float)BOX8; + totals[cc] /= BOX8; } extract.shove( totals, outIndex, dataOut ); outIndex++; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java index 18f814dde..ef77f3555 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java @@ -46,6 +46,9 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; + import java.nio.*; /** @@ -58,14 +61,14 @@ public class Image { public Image() { } - public static short getShortFromByteArray( byte[] array, int index ) { + public static short getShortFromByteArray( final byte[] array, final int index ) { short s; s = (short)(array[index] << 8 ); s |= (short)(0x00FF & array[index+1]); return( s ); } - public static int getIntFromByteArray( byte[] array, int index ) { + public static int getIntFromByteArray( final byte[] array, final int index ) { int i; i = ( array[index] << 24 ) & 0xFF000000; i |= ( array[index+1] << 16 ) & 0x00FF0000; @@ -74,8 +77,8 @@ public class Image { return( i ); } - public static float getFloatFromByteArray( byte[] array, int index ) { - int i = getIntFromByteArray( array, index ); + public static float getFloatFromByteArray( final byte[] array, final int index ) { + final int i = getIntFromByteArray( array, index ); return( Float.intBitsToFloat(i) ); } @@ -83,9 +86,9 @@ public class Image { * Extract array from user's data applying all pixel store modes. * The internal format used is an array of unsigned shorts. */ - public static void fill_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, ByteBuffer userdata, - ShortBuffer newimage ) { + public static void fill_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, final ByteBuffer userdata, + final ShortBuffer newimage ) { int components; int element_size; int rowsize; @@ -102,40 +105,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -214,74 +217,74 @@ public class Image { iter = start; userdata.position( iter ); //*************************************** for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); - float[] extractComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] extractComponents = new float[4]; userdata.position( iter ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { newimage.put( iter2++, (short)( 0x000000FF & userdata.get() ) );//userdata[iter]; } else { newimage.put( iter2++, (short)( 0x000000FF & userdata.get()/*userdata[iter]*/ * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { newimage.put( iter2++, userdata.get() ); //userdata[iter]; } else { newimage.put( iter2++, (short)(userdata.get()/*userdata[iter]*/ * 516 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract.extract( myswap_bytes, userdata/*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswap_bytes ) { widget.setUB1( userdata.get() ); widget.setUB0( userdata.get() ); @@ -289,7 +292,7 @@ public class Image { widget.setUB0( userdata.get() ); widget.setUB1( userdata.get() ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( index_format ) { newimage.put( iter2++, widget.getS0() ); } else { @@ -299,33 +302,33 @@ public class Image { newimage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswap_bytes ) { widget.setUB3( userdata.get() ); widget.setUB2( userdata.get() ); @@ -337,13 +340,13 @@ public class Image { widget.setUB2( userdata.get() ); widget.setUB3( userdata.get() ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( index_format ) { newimage.put( iter2++, (short)widget.getF() ); } else { newimage.put( iter2++, (short)(widget.getF() * 65535 ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { newimage.put( iter2++, (short)( widget.getUI() ) ); } else { @@ -380,9 +383,9 @@ public class Image { * Theinternal format is an array of unsigned shorts. * empty_image() because it is the opposet of fill_image(). */ - public static void empty_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, - ShortBuffer oldimage, ByteBuffer userdata ) { + public static void empty_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, + final ShortBuffer oldimage, final ByteBuffer userdata ) { int components; int element_size; @@ -400,40 +403,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -499,7 +502,7 @@ public class Image { start += rowsize; } } else { - float shoveComponents[] = new float[4]; + final float shoveComponents[] = new float[4]; element_size = Mipmap.bytes_per_element( type ); group_size = element_size * components; @@ -519,22 +522,22 @@ public class Image { for( i = 0; i < height; i++ ) { iter = start; for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); + final Type_Widget widget = new Type_Widget(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -543,7 +546,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -552,7 +555,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -569,7 +572,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -586,7 +589,7 @@ public class Image { userdata.put( iter, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -603,7 +606,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -620,7 +623,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -637,7 +640,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -654,9 +657,9 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( index_format ) { widget.setS0( oldimage.get( iter2++ ) ); } else { @@ -677,7 +680,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -695,7 +698,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -713,7 +716,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -731,7 +734,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -749,16 +752,16 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( index_format ) { widget.setF( oldimage.get( iter2++ ) ); } else { widget.setF( oldimage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { widget.setUI( oldimage.get( iter2++ ) ); } else { @@ -800,9 +803,9 @@ public class Image { } } - public static void fillImage3D( PixelStorageModes psm, int width, int height, - int depth, int format, int type, boolean indexFormat, ByteBuffer userImage, - ShortBuffer newImage ) { + public static void fillImage3D( final PixelStorageModes psm, final int width, final int height, + final int depth, final int format, final int type, final boolean indexFormat, final ByteBuffer userImage, + final ShortBuffer newImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -817,46 +820,46 @@ public class Image { int iter = 0; int iter2 = 0; int ww, hh, dd, k; - Type_Widget widget = new Type_Widget(); - float extractComponents[] = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float extractComponents[] = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -903,78 +906,78 @@ public class Image { for( ww = 0; ww < elementsPerLine; ww++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { newImage.put( iter2++, (short)(0x000000FF & userImage.get( iter ) ) ); } else { newImage.put( iter2++, (short)((0x000000FF & userImage.get( iter ) ) * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { newImage.put( iter2++, userImage.get( iter ) ); } else { newImage.put( iter2++, (short)(userImage.get( iter ) * 516 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 1 ) ); widget.setUB1( userImage.get( iter ) ); @@ -982,7 +985,7 @@ public class Image { widget.setUB0( userImage.get( iter ) ); widget.setUB1( userImage.get( iter + 1 ) ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( indexFormat ) { newImage.put( iter2++, widget.getUS0() ); } else { @@ -992,36 +995,36 @@ public class Image { newImage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 3 ) ); widget.setUB1( userImage.get( iter + 2 ) ); @@ -1033,13 +1036,13 @@ public class Image { widget.setUB2( userImage.get( iter + 2 ) ); widget.setUB3( userImage.get( iter + 3 ) ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getF() ); } else { newImage.put( iter2++, (short)( widget.getF() * 65535.0f ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getUI() ); } else { @@ -1075,8 +1078,8 @@ public class Image { psm.getUnpackSkipImages() * imageSize ); } - public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth, - int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) { + public static void emptyImage3D( final PixelStorageModes psm, final int width, final int height, final int depth, + final int format, final int type, final boolean indexFormat, final ShortBuffer oldImage, final ByteBuffer userImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -1090,46 +1093,46 @@ public class Image { int ii, jj, dd, k; int rowsPerImage; int imageSize; - Type_Widget widget = new Type_Widget(); - float[] shoveComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] shoveComponents = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -1182,33 +1185,33 @@ public class Image { for( jj = 0; jj < elementsPerLine; jj++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get( iter2++ ) ) ); } else { userImage.put( iter, (byte)(oldImage.get( iter2++ ) >> 8 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get(iter2++) ) ); } else { userImage.put( iter, (byte)(oldImage.get(iter2++) >> 9) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1220,7 +1223,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1232,7 +1235,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1244,7 +1247,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1256,7 +1259,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1268,7 +1271,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1280,16 +1283,16 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( indexFormat ) { - widget.setS0( (short)oldImage.get( iter2++ ) ); + widget.setS0( oldImage.get( iter2++ ) ); } else { widget.setS0( (short)(oldImage.get( iter2++ ) >> 1) ); } } else { - widget.setUS0( (short)oldImage.get( iter2++ ) ); + widget.setUS0( oldImage.get( iter2++ ) ); } if( myswapBytes ) { userImage.put( iter, widget.getUB1() ); @@ -1299,7 +1302,7 @@ public class Image { userImage.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1313,7 +1316,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1327,7 +1330,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1341,7 +1344,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1355,16 +1358,16 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( indexFormat ) { widget.setF( oldImage.get( iter2++ ) ); } else { widget.setF( oldImage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { widget.setUI( oldImage.get( iter2++ ) ); } else { diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java index 938873ec5..fba6a231a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java @@ -46,10 +46,14 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.GLException; + import java.nio.*; + import com.jogamp.common.nio.Buffers; /** @@ -108,7 +112,7 @@ public class Mipmap { return( s ); } - public static int GLU_SWAP_4_BYTES( int i ) { + public static int GLU_SWAP_4_BYTES( final int i ) { int t = i << 24; t |= 0x00FF0000 & ( i << 8 ); t |= 0x0000FF00 & ( i >>> 8 ); @@ -116,17 +120,17 @@ public class Mipmap { return( t ); } - public static float GLU_SWAP_4_BYTES( float f ) { - int i = Float.floatToRawIntBits( f ); - float temp = Float.intBitsToFloat( i ); + public static float GLU_SWAP_4_BYTES( final float f ) { + final int i = Float.floatToRawIntBits( f ); + final float temp = Float.intBitsToFloat( i ); return( temp ); } - public static int checkMipmapArgs( int internalFormat, int format, int type ) { + public static int checkMipmapArgs( final int internalFormat, final int format, final int type ) { if( !legalFormat( format ) || !legalType( type ) ) { return( GLU.GLU_INVALID_ENUM ); } - if( format == GL2GL3.GL_STENCIL_INDEX ) { + if( format == GL2ES2.GL_STENCIL_INDEX ) { return( GLU.GLU_INVALID_ENUM ); } if( !isLegalFormatForPackedPixelType( format, type ) ) { @@ -135,19 +139,19 @@ public class Mipmap { return( 0 ); } - public static boolean legalFormat( int format ) { + public static boolean legalFormat( final int format ) { switch( format ) { case( GL2.GL_COLOR_INDEX ): - 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( GL2ES2.GL_STENCIL_INDEX ): + case( GL2ES2.GL_DEPTH_COMPONENT ): + case( GL2ES2.GL_RED ): + case( GL2ES3.GL_GREEN ): + case( GL2ES3.GL_BLUE ): + case( GL.GL_ALPHA ): + case( GL.GL_RGB ): + case( GL.GL_RGBA ): + case( GL.GL_LUMINANCE ): + case( GL.GL_LUMINANCE_ALPHA ): case( GL2GL3.GL_BGR ): case( GL.GL_BGRA ): return( true ); @@ -156,55 +160,55 @@ public class Mipmap { } } - public static boolean legalType( int type ) { + public static boolean legalType( final int type ) { switch( type ) { case( GL2.GL_BITMAP ): - 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( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.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( GL.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( GL.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( GL.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 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): return( true ); default: return( false ); } } - public static boolean isTypePackedPixel( int type ) { + public static boolean isTypePackedPixel( final int type ) { assert( legalType( type ) ); 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 == GL.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 == GL.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 == GL.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 ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( true ); } return( false ); } - public static boolean isLegalFormatForPackedPixelType( int format, int type ) { + public static boolean isLegalFormatForPackedPixelType( final int format, final int type ) { // if not a packed pixel type then return true if( isTypePackedPixel( type ) ) { return( true ); @@ -212,29 +216,29 @@ public class Mipmap { // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with 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 ) { + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) + & format != GL.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 == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + if( ( type == GL.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 == GL.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 ) && + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) && (format != GL.GL_RGBA && format != GL.GL_BGRA) ) { return( false ); } return( true ); } - public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel, - int totalLevels ) { + public static boolean isLegalLevels( final int userLevel, final int baseLevel, final int maxLevel, + final int totalLevels ) { if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) || (totalLevels < maxLevel) ) { return( false ); @@ -249,13 +253,13 @@ public class Mipmap { * advertise the texture extension. * Note that proxy textures are implemented but not according to spec in IMPACT* */ - public static void closestFit( GL gl, int target, int width, int height, int internalFormat, - int format, int type, int[] newWidth, int[] newHeight ) { + public static void closestFit( final GL gl, final int target, final int width, final int height, final int internalFormat, + final int format, final int type, final int[] newWidth, final int[] newHeight ) { // Use proxy textures if OpenGL version >= 1.1 if( Double.parseDouble( gl.glGetString( GL.GL_VERSION ).trim().substring( 0, 3 ) ) >= 1.1 ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; boolean noProxyTextures = false; // Some drivers (in particular, ATI's) seem to set a GL error @@ -265,24 +269,24 @@ public class Mipmap { try { do { // compute level 1 width & height, clamping each at 1 - int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); - int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); + final int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); + final int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); int proxyTarget; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); // does width x height at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { + if( target == GL.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 == 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) ) { + } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_CUBE_MAP; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); @@ -313,7 +317,7 @@ public class Mipmap { } // else it does fit } while( proxyWidth[0] == 0 ); - } catch (GLException e) { + } catch (final GLException e) { noProxyTextures = true; } // loop must terminate @@ -324,8 +328,8 @@ public class Mipmap { return; } } - int[] maxsize = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_MAX_TEXTURE_SIZE, maxsize , 0); + final int[] maxsize = new int[1]; + gl.glGetIntegerv( GL.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] ) { @@ -337,26 +341,26 @@ public class Mipmap { } } - public static void closestFit3D( GL gl, int target, int width, int height, int depth, - int internalFormat, int format, int type, int[] newWidth, int[] newHeight, - int[] newDepth ) { + public static void closestFit3D( final GL gl, final int target, final int width, final int height, final int depth, + final int internalFormat, final int format, final int type, final int[] newWidth, final int[] newHeight, + final int[] newDepth ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); int depthPowerOf2 = nearestPower( depth ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; do { // compute level 1 width & height & depth, clamping each at 1 - int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; - int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; - int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; + final int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; + final int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; + final int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; int proxyTarget = 0; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); assert( depthAtLevelOne > 0 ); // does width x height x depth at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { + if( target == GL2ES2.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 ); @@ -385,31 +389,31 @@ public class Mipmap { newDepth[0] = depthPowerOf2; } - public static int elements_per_group( int format, int type ) { + public static int elements_per_group( final int format, final int type ) { // Return the number of elements per grtoup of a specified gromat // If the type is packedpixels then answer is 1 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 == GL.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 == GL.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 == GL.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 ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( 1 ); } // Types are not packed pixels so get elements per group switch( format ) { - case( GL2GL3.GL_RGB ): + case( GL.GL_RGB ): case( GL2GL3.GL_BGR ): return( 3 ); - case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL.GL_LUMINANCE_ALPHA ): return( 2 ); case( GL.GL_RGBA ): case( GL.GL_BGRA ): @@ -419,45 +423,45 @@ public class Mipmap { } } - public static int bytes_per_element( int type ) { + public static int bytes_per_element( final int type ) { // return the number of bytes per element, based on the element type switch( type ) { case( GL2.GL_BITMAP ): - case( GL2GL3.GL_BYTE ): - case( GL2GL3.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): return( 1 ); - case( GL2GL3.GL_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.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( GL.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( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): return( 2 ); - case( GL2GL3.GL_INT ): - case( GL2GL3.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.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 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_FLOAT ): return( 4 ); default: return( 4 ); } } - public static boolean is_index( int format ) { - return( format == GL2.GL_COLOR_INDEX || format == GL2GL3.GL_STENCIL_INDEX ); + public static boolean is_index( final int format ) { + return( format == GL2.GL_COLOR_INDEX || format == GL2ES2.GL_STENCIL_INDEX ); } /* Compute memory required for internal packed array of data of given type and format. */ - public static int image_size( int width, int height, int format, int type ) { + public static int image_size( final int width, final int height, final int format, final int type ) { int bytes_per_row; int components; @@ -472,9 +476,9 @@ public class Mipmap { return( bytes_per_row * height * components ); } - public static int imageSize3D( int width, int height, int depth, int format, int type ) { - int components = elements_per_group( format, type ); - int bytes_per_row = bytes_per_element( type ) * width; + public static int imageSize3D( final int width, final int height, final int depth, final int format, final int type ) { + final int components = elements_per_group( format, type ); + final int bytes_per_row = bytes_per_element( type ) * width; assert( width > 0 && height > 0 && depth > 0 ); assert( type != GL2.GL_BITMAP ); @@ -482,28 +486,28 @@ public class Mipmap { return( bytes_per_row * height * depth * components ); } - public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -511,32 +515,32 @@ public class Mipmap { psm.setPackSwapBytes( ( a[0] == 1 ) ); } - public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes3D( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_IMAGES, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_SKIP_IMAGES, a, 0); psm.setUnpackSkipImages( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, a, 0); psm.setUnpackImageHeight( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0 ); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0 ); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0 ); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -548,17 +552,17 @@ public class Mipmap { psm.setPackImageHeight( a[0] ); } - public static int gluScaleImage( GL gl, int format, int widthin, int heightin, - int typein, ByteBuffer datain, int widthout, int heightout, - int typeout, ByteBuffer dataout ) { - int datainPos = datain.position(); - int dataoutPos = dataout.position(); + public static int gluScaleImage( final GL gl, final int format, final int widthin, final int heightin, + final int typein, final ByteBuffer datain, final int widthout, final int heightout, + final int typeout, final ByteBuffer dataout ) { + final int datainPos = datain.position(); + final int dataoutPos = dataout.position(); try { int components; ByteBuffer beforeimage; ByteBuffer afterimage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) { return( 0 ); @@ -575,8 +579,8 @@ public class Mipmap { if( !isLegalFormatForPackedPixelType( format, typeout ) ) { return( GLU.GLU_INVALID_OPERATION ); } - beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL2GL3.GL_UNSIGNED_SHORT ) ); - afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL2GL3.GL_UNSIGNED_SHORT ) ); + beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL.GL_UNSIGNED_SHORT ) ); + afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL.GL_UNSIGNED_SHORT ) ); if( beforeimage == null || afterimage == null ) { return( GLU.GLU_OUT_OF_MEMORY ); } @@ -594,15 +598,15 @@ public class Mipmap { } } - public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat, - int width, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -625,16 +629,16 @@ public class Mipmap { } } - public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width, - int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmaps( final GL gl, final int target, final int internalFormat, final int width, + final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; int levels; - int[] dummy = new int[1]; + final int[] dummy = new int[1]; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -654,14 +658,14 @@ public class Mipmap { } - public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int format, int type, int userLevel, - int baseLevel, int maxLevel, Object data ) { + public static int gluBuild2DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final Object data ) { int dataPos = 0; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -687,23 +691,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -717,15 +721,15 @@ public class Mipmap { } - public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, Object data ) { + public static int gluBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final Object data ) { int dataPos = 0; - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -749,23 +753,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -779,17 +783,17 @@ public class Mipmap { } - public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; - int[] depthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; + final int[] depthPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -823,14 +827,14 @@ public class Mipmap { } } - public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java index 7eb98db35..9b26647a8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java @@ -147,7 +147,7 @@ public class PixelStorageModes { * Setter for property packAlignment. * @param packAlignment New value of property packAlignment. */ - public void setPackAlignment(int packAlignment) { + public void setPackAlignment(final int packAlignment) { this.packAlignment = packAlignment; } @@ -165,7 +165,7 @@ public class PixelStorageModes { * Setter for property packRowLength. * @param packRowLength New value of property packRowLength. */ - public void setPackRowLength(int packRowLength) { + public void setPackRowLength(final int packRowLength) { this.packRowLength = packRowLength; } @@ -183,7 +183,7 @@ public class PixelStorageModes { * Setter for property packSkipRows. * @param packSkipRows New value of property packSkipRows. */ - public void setPackSkipRows(int packSkipRows) { + public void setPackSkipRows(final int packSkipRows) { this.packSkipRows = packSkipRows; } @@ -201,7 +201,7 @@ public class PixelStorageModes { * Setter for property packSkipPixels. * @param packSkipPixels New value of property packSkipPixels. */ - public void setPackSkipPixels(int packSkipPixels) { + public void setPackSkipPixels(final int packSkipPixels) { this.packSkipPixels = packSkipPixels; } @@ -219,7 +219,7 @@ public class PixelStorageModes { * Setter for property packLsbFirst. * @param packLsbFirst New value of property packLsbFirst. */ - public void setPackLsbFirst(boolean packLsbFirst) { + public void setPackLsbFirst(final boolean packLsbFirst) { this.packLsbFirst = packLsbFirst; } @@ -237,7 +237,7 @@ public class PixelStorageModes { * Setter for property packSwapBytes. * @param packSwapBytes New value of property packSwapBytes. */ - public void setPackSwapBytes(boolean packSwapBytes) { + public void setPackSwapBytes(final boolean packSwapBytes) { this.packSwapBytes = packSwapBytes; } @@ -255,7 +255,7 @@ public class PixelStorageModes { * Setter for property packSkipImages. * @param packSkipImages New value of property packSkipImages. */ - public void setPackSkipImages(int packSkipImages) { + public void setPackSkipImages(final int packSkipImages) { this.packSkipImages = packSkipImages; } @@ -273,7 +273,7 @@ public class PixelStorageModes { * Setter for property packImageHeight. * @param packImageHeight New value of property packImageHeight. */ - public void setPackImageHeight(int packImageHeight) { + public void setPackImageHeight(final int packImageHeight) { this.packImageHeight = packImageHeight; } @@ -291,7 +291,7 @@ public class PixelStorageModes { * Setter for property unpackAlignment. * @param unpackAlignment New value of property unpackAlignment. */ - public void setUnpackAlignment(int unpackAlignment) { + public void setUnpackAlignment(final int unpackAlignment) { this.unpackAlignment = unpackAlignment; } @@ -309,7 +309,7 @@ public class PixelStorageModes { * Setter for property unpackRowLength. * @param unpackRowLength New value of property unpackRowLength. */ - public void setUnpackRowLength(int unpackRowLength) { + public void setUnpackRowLength(final int unpackRowLength) { this.unpackRowLength = unpackRowLength; } @@ -327,7 +327,7 @@ public class PixelStorageModes { * Setter for property unpackSkipRows. * @param unpackSkipRows New value of property unpackSkipRows. */ - public void setUnpackSkipRows(int unpackSkipRows) { + public void setUnpackSkipRows(final int unpackSkipRows) { this.unpackSkipRows = unpackSkipRows; } @@ -345,7 +345,7 @@ public class PixelStorageModes { * Setter for property unpackSkipPixels. * @param unpackSkipPixels New value of property unpackSkipPixels. */ - public void setUnpackSkipPixels(int unpackSkipPixels) { + public void setUnpackSkipPixels(final int unpackSkipPixels) { this.unpackSkipPixels = unpackSkipPixels; } @@ -363,7 +363,7 @@ public class PixelStorageModes { * Setter for property unpackLsbFirst. * @param unpackLsbFirst New value of property unpackLsbFirst. */ - public void setUnpackLsbFirst(boolean unpackLsbFirst) { + public void setUnpackLsbFirst(final boolean unpackLsbFirst) { this.unpackLsbFirst = unpackLsbFirst; } @@ -381,7 +381,7 @@ public class PixelStorageModes { * Setter for property unpackSwapBytes. * @param unpackSwapBytes New value of property unpackSwapBytes. */ - public void setUnpackSwapBytes(boolean unpackSwapBytes) { + public void setUnpackSwapBytes(final boolean unpackSwapBytes) { this.unpackSwapBytes = unpackSwapBytes; } @@ -399,7 +399,7 @@ public class PixelStorageModes { * Setter for property unpackSkipImages. * @param unpackSkipImages New value of property unpackSkipImages. */ - public void setUnpackSkipImages(int unpackSkipImages) { + public void setUnpackSkipImages(final int unpackSkipImages) { this.unpackSkipImages = unpackSkipImages; } @@ -417,7 +417,7 @@ public class PixelStorageModes { * Setter for property unpackImageHeight. * @param unpackImageHeight New value of property unpackImageHeight. */ - public void setUnpackImageHeight(int unpackImageHeight) { + public void setUnpackImageHeight(final int unpackImageHeight) { this.unpackImageHeight = unpackImageHeight; } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java index 9aca1fb03..ccb75091c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java @@ -56,16 +56,16 @@ import com.jogamp.common.nio.Buffers; */ public class ScaleInternal { - public static final float UINT_MAX = (float)(0x00000000FFFFFFFF); + public static final float UINT_MAX = (0x00000000FFFFFFFF); - public static void scale_internal( int components, int widthin, int heightin, - ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) { + public static void scale_internal( final int components, final int widthin, final int heightin, + final ShortBuffer datain, final int widthout, final int heightout, final ShortBuffer dataout ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float xpercent, ypercent; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, yint, xint, xindex, yindex; int temp; @@ -147,14 +147,16 @@ public class ScaleInternal { } } - public static void scale_internal_ubyte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_ubyte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -356,7 +358,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -372,15 +374,17 @@ public class ScaleInternal { } } - public static void scale_internal_byte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, - int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_byte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, + final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -581,7 +585,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -597,15 +601,17 @@ public class ScaleInternal { } } - public static void scale_internal_ushort( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_ushort( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -673,7 +679,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; } @@ -684,7 +690,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; } @@ -869,7 +875,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -885,15 +891,17 @@ public class ScaleInternal { } } - public static void scale_internal_short( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_short( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1173,7 +1181,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1189,15 +1197,17 @@ public class ScaleInternal { } } - public static void scale_internal_uint( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_uint( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1416,9 +1426,9 @@ public class ScaleInternal { percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); temp = xindex + (lowy_int * ysize); for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); + final long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); datain.position( temp_index ); - long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); + final long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); datain.position( temp_index ); if( myswap_bytes ) { totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; @@ -1468,7 +1478,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1484,15 +1494,17 @@ public class ScaleInternal { } } - public static void scale_internal_int( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_int( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1772,7 +1784,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1788,15 +1800,17 @@ public class ScaleInternal { } } - public static void scale_internal_float( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_float( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -2076,7 +2090,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -2092,25 +2106,27 @@ public class ScaleInternal { } } - public static void scaleInternalPackedPixel( int components, Extract extract, - int widthIn, int heightIn, ByteBuffer dataIn, int widthOut, - int heightOut, ByteBuffer dataOut, int pixelSizeInBytes, - int rowSizeInBytes, boolean isSwap ) { - float x, convx; - float y, convy; + public static void scaleInternalPackedPixel( final int components, final Extract extract, + final int widthIn, final int heightIn, final ByteBuffer dataIn, final int widthOut, + final int heightOut, final ByteBuffer dataOut, final int pixelSizeInBytes, + final int rowSizeInBytes, final boolean isSwap ) { + final float x; + float convx; + final float y; + float convy; float percent; // max components in a format is 4, so - float[] totals = new float[4]; - float[] extractTotals = new float[4]; - float[] extractMoreTotals = new float[4]; - float[] shoveTotals = new float[4]; + final float[] totals = new float[4]; + final float[] extractTotals = new float[4]; + final float[] extractMoreTotals = new float[4]; + final float[] shoveTotals = new float[4]; float area; int i, j, k, xindex; int temp, temp0; - int temp_index; + final int temp_index; int outIndex = 0; int lowx_int, highx_int, lowy_int, highy_int; @@ -2309,7 +2325,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthIn - 1) { - int delta = (highx_int - widthIn + 1); + final int delta = (highx_int - widthIn + 1); lowx_int -= delta; highx_int -= delta; } @@ -2326,16 +2342,16 @@ public class ScaleInternal { assert( outIndex == ( widthOut * heightOut - 1) ); } - public static void scaleInternal3D( int components, int widthIn, int heightIn, - int depthIn, ShortBuffer dataIn, int widthOut, int heightOut, - int depthOut, ShortBuffer dataOut ) { + public static void scaleInternal3D( final int components, final int widthIn, final int heightIn, + final int depthIn, final ShortBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final ShortBuffer dataOut ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float z, lowz, highz, convz, halfconvz; float xpercent, ypercent, zpercent; float percent; // max compnents in a format is 4 - float[] totals = new float[4]; + final float[] totals = new float[4]; float volume; int i, j, d, k, zint, yint, xint, xindex, yindex, zindex; int temp; @@ -2442,12 +2458,12 @@ public class ScaleInternal { } } - public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, - int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, - int depthOut, int typeOut, ByteBuffer dataOut ) { + public static int gluScaleImage3D( final GL gl, final int format, final int widthIn, final int heightIn, + final int depthIn, final int typeIn, final ByteBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final int typeOut, final ByteBuffer dataOut ) { int components; ShortBuffer beforeImage, afterImage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( widthIn == 0 || heightIn == 0 || depthIn == 0 || widthOut == 0 || heightOut == 0 || depthOut == 0 ) { @@ -2475,10 +2491,10 @@ public class ScaleInternal { try { beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError err ) { + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } Mipmap.retrieveStoreModes3D( gl, psm ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java index dc401880d..8683f75ac 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java @@ -61,7 +61,7 @@ public class Type_Widget { buffer = ByteBuffer.allocate( 4 ); } - public void setUB0( byte b ) { + public void setUB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -71,7 +71,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB1( byte b ) { + public void setUB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -81,7 +81,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB2( byte b ) { + public void setUB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -91,7 +91,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB3( byte b ) { + public void setUB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -101,7 +101,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUS0( short s ) { + public void setUS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -111,7 +111,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUS1( short s ) { + public void setUS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -121,7 +121,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUI( int i ) { + public void setUI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -131,7 +131,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setB0( byte b ) { + public void setB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -141,7 +141,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB1( byte b ) { + public void setB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -151,7 +151,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB2( byte b ) { + public void setB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -161,7 +161,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB3( byte b ) { + public void setB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -171,7 +171,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setS0( short s ) { + public void setS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -181,7 +181,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setS1( short s ) { + public void setS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -191,7 +191,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setI( int i ) { + public void setI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -201,7 +201,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setF( float f ) { + public void setF( final float f ) { buffer.position( 0 ); buffer.putFloat( f ); } @@ -216,8 +216,8 @@ public class Type_Widget { return( buffer ); } - public static void main( String args[] ) { - Type_Widget t = new Type_Widget(); + public static void main( final String args[] ) { + final Type_Widget t = new Type_Widget(); t.setI( 1000000 ); System.out.println("int: " + Integer.toHexString( t.getI() ) ); |