diff options
author | Kenneth Russel <[email protected]> | 2005-07-08 16:02:53 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-07-08 16:02:53 +0000 |
commit | c6d6bcbcaceaa229944f380437a28af3a84f1dcd (patch) | |
tree | 5415f8a6a956de81ffe7abd01451f99c76f23824 /src/net/java/games/jogl/impl/mipmap | |
parent | 0fa2740c8c186b0908baa5b7629bef657fe38527 (diff) |
Fixed Windows port after changes to GlueGen to include array offsets.
Ported all demos to new API. Temporarily added back in GLU entry
points taking primitive arrays as the underlying APIs (in particular,
glTexImage2D) do not yet support non-direct Buffers. Changed C code
generation to only add in array offset if array is non-null. Fixed bug
in GLU tesselator demo's vertex callback.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@318 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.java | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/net/java/games/jogl/impl/mipmap/Mipmap.java b/src/net/java/games/jogl/impl/mipmap/Mipmap.java index 052d39fa2..8b697f37c 100644 --- a/src/net/java/games/jogl/impl/mipmap/Mipmap.java +++ b/src/net/java/games/jogl/impl/mipmap/Mipmap.java @@ -642,7 +642,26 @@ 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, @@ -678,7 +697,26 @@ 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, |