aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/mipmap
diff options
context:
space:
mode:
authorTravis Bryson <[email protected]>2005-06-24 20:28:37 +0000
committerTravis Bryson <[email protected]>2005-06-24 20:28:37 +0000
commit0969a98f2007d76e38f8819eedfead5b840f6364 (patch)
tree82aff6a7fb922f45fc7853e5c5442af0d978768f /src/net/java/games/jogl/impl/mipmap
parented85f53f73d69a44c6b98b3824354be3fbb7bf58 (diff)
This putback adds array offsets to the public JOGL API. The offsets are
respected and used properly in all of the public and private functions. The changes are in gluegen, so that the code is generated properly. And also throughout the parts of the jogl code that are not gluegen-generated. For the internally generated implementation methods, a "1" is added to the method names. So as to not overload the public API. This is similar to what is already done with Buffer APIs, which have a "0" added internally. I used a "1" instead of a "0" to avoid any collisions of the signatures, which could happen if a null object was sent down for the Array (e.g., the wrong method would get called). This should be a suitable foundation for the implementation to add the ability to wrap arrays in Buffers, which we plan to add to the implementation soon. These changes will cause all existing JOGL programs to break, although adapting them is pretty easy. We will later be putting back changed examples and utilities that incorporate these new APIs. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@313 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/mipmap')
-rw-r--r--src/net/java/games/jogl/impl/mipmap/Mipmap.java121
1 files changed, 43 insertions, 78 deletions
diff --git a/src/net/java/games/jogl/impl/mipmap/Mipmap.java b/src/net/java/games/jogl/impl/mipmap/Mipmap.java
index a66edfc44..63cf760e2 100644
--- a/src/net/java/games/jogl/impl/mipmap/Mipmap.java
+++ b/src/net/java/games/jogl/impl/mipmap/Mipmap.java
@@ -257,7 +257,7 @@ public class Mipmap {
if( target == GL.GL_TEXTURE_2D || target == GL.GL_PROXY_TEXTURE_2D ) {
proxyTarget = GL.GL_PROXY_TEXTURE_2D;
gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, 0, format, type, (double[])null );
+ heightAtLevelOne, 0, format, type, (double[])null, 0);
} else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) ||
(target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) ||
(target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) ||
@@ -266,14 +266,14 @@ public class Mipmap {
(target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ) {
proxyTarget = GL.GL_PROXY_TEXTURE_CUBE_MAP_ARB;
gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, 0, format, type, (double[])null );
+ heightAtLevelOne, 0, format, type, (double[])null , 0);
} else {
assert( target == GL.GL_TEXTURE_1D || target == GL.GL_PROXY_TEXTURE_1D );
proxyTarget = GL.GL_PROXY_TEXTURE_1D;
gl.glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- 0, format, type, (double[])null );
+ 0, format, type, (double[])null, 0);
}
- gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth );
+ gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 );
// does it fit?
if( proxyWidth[0] == 0 ) { // nope, so try again with theses sizes
if( widthPowerOf2 == 1 && heightPowerOf2 == 1 ) {
@@ -299,7 +299,7 @@ public class Mipmap {
}
}
int[] maxsize = new int[1];
- gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize );
+ 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] ) {
@@ -333,9 +333,9 @@ public class Mipmap {
if( target == GL.GL_TEXTURE_3D || target == GL.GL_PROXY_TEXTURE_3D ) {
proxyTarget = GL.GL_PROXY_TEXTURE_3D;
gl.glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, depthAtLevelOne, 0, format, type, (double[])null );
+ heightAtLevelOne, depthAtLevelOne, 0, format, type, (double[])null, 0 );
}
- gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth );
+ gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 );
// does it fit
if( proxyWidth[0] == 0 ) {
if( widthPowerOf2 == 1 && heightPowerOf2 == 1 && depthPowerOf2 == 1 ) {
@@ -454,67 +454,67 @@ public class Mipmap {
public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) {
int[] a = new int[1];
- gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0);
psm.setUnpackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a, 0);
psm.setUnpackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a, 0);
psm.setUnpackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a, 0);
psm.setUnpackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a, 0);
psm.setUnpackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a, 0);
psm.setUnpackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a, 0);
psm.setPackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a, 0);
psm.setPackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a, 0);
psm.setPackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a, 0);
psm.setPackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a, 0);
psm.setPackSwapBytes( ( a[0] == 1 ) );
}
public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) {
int[] a = new int[1];
- gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0);
psm.setUnpackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a, 0);
psm.setUnpackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a, 0);
psm.setUnpackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a, 0);
psm.setUnpackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a, 0);
psm.setUnpackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a, 0);
psm.setUnpackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_IMAGES, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_IMAGES, a, 0);
psm.setUnpackSkipImages( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_IMAGE_HEIGHT, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_IMAGE_HEIGHT, a, 0);
psm.setUnpackImageHeight( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a, 0);
psm.setPackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a, 0);
psm.setPackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a, 0 );
psm.setPackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a, 0 );
psm.setPackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a, 0 );
psm.setPackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_IMAGES, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_IMAGES, a, 0 );
psm.setPackSkipImages( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_IMAGE_HEIGHT, a );
+ gl.glGetIntegerv( GL.GL_PACK_IMAGE_HEIGHT, a, 0 );
psm.setPackImageHeight( a[0] );
}
@@ -602,7 +602,8 @@ public class Mipmap {
return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat,
width, widthPowerOf2[0], format, type, 0, 0, levels, data ) );
}
-
+
+
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 ) {
@@ -632,32 +633,14 @@ public class Mipmap {
ByteBuffer buffer = null;
if( data instanceof ByteBuffer ) {
buffer = (ByteBuffer)data;
- } else if( data instanceof byte[] ) {
- byte[] array = (byte[])data;
- buffer = ByteBuffer.allocateDirect(array.length);
- buffer.put(array);
- } else if( data instanceof short[] ) {
- short[] array = (short[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 2 );
- ShortBuffer sb = buffer.asShortBuffer();
- sb.put( array );
- } else if( data instanceof int[] ) {
- int[] array = (int[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- IntBuffer ib = buffer.asIntBuffer();
- ib.put( array );
- } else if( data instanceof float[] ) {
- float[] array = (float[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- FloatBuffer fb = buffer.asFloatBuffer();
- fb.put( array );
- }
+ }
return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat,
width, height, width, height, format, type, userLevel, baseLevel,
maxLevel, buffer ) );
}
-
+
+
public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat,
int width, int height, int format, int type, Object data ) {
int[] widthPowerOf2 = new int[1];
@@ -686,32 +669,14 @@ public class Mipmap {
ByteBuffer buffer = null;
if( data instanceof ByteBuffer ) {
buffer = (ByteBuffer)data;
- } else if( data instanceof byte[] ) {
- byte[] array = (byte[])data;
- buffer = ByteBuffer.allocateDirect(array.length);
- buffer.put(array);
- } else if( data instanceof short[] ) {
- short[] array = (short[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 2 );
- ShortBuffer sb = buffer.asShortBuffer();
- sb.put( array );
- } else if( data instanceof int[] ) {
- int[] array = (int[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- IntBuffer ib = buffer.asIntBuffer();
- ib.put( array );
- } else if( data instanceof float[] ) {
- float[] array = (float[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- FloatBuffer fb = buffer.asFloatBuffer();
- fb.put( array );
- }
+ }
return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat,
width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0,
0, levels, buffer ) );
}
-
+
+
public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat,
int width, int height, int depth, int format, int type, ByteBuffer data ) {
int[] widthPowerOf2 = new int[1];