diff options
author | Sven Gothel <[email protected]> | 2008-09-02 05:33:27 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-09-02 05:33:27 +0000 |
commit | 6e14457eac32f838fcdfe9b4b4e26fe7a7d13936 (patch) | |
tree | 6b1396b4c6d7a5bf891cf78c0c42cb27b830426b /src/classes/javax/media/opengl/util | |
parent | c7e5336fe362e721fdafdf55e1304b63b33026fc (diff) |
Fix: TextureIO/TGA for ES2 (GL formats/types)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1768 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/util')
-rwxr-xr-x | src/classes/javax/media/opengl/util/BufferUtil.java.javame_cdc_fp | 17 | ||||
-rwxr-xr-x | src/classes/javax/media/opengl/util/BufferUtil.java.javase | 19 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/classes/javax/media/opengl/util/BufferUtil.java.javame_cdc_fp b/src/classes/javax/media/opengl/util/BufferUtil.java.javame_cdc_fp index 2496950be..e743658cd 100755 --- a/src/classes/javax/media/opengl/util/BufferUtil.java.javame_cdc_fp +++ b/src/classes/javax/media/opengl/util/BufferUtil.java.javame_cdc_fp @@ -85,6 +85,23 @@ public class BufferUtil { return -1; } + public static final int sizeOfBufferElem(Buffer buffer) { + if (buffer == null) { + return 0; + } + if (buffer instanceof ByteBuffer) { + return BufferUtil.SIZEOF_BYTE; + } else if (buffer instanceof IntBuffer) { + return BufferUtil.SIZEOF_INT; + } else if (buffer instanceof ShortBuffer) { + return BufferUtil.SIZEOF_SHORT; + } else if (buffer instanceof FloatBuffer) { + return BufferUtil.SIZEOF_FLOAT; + } + throw new RuntimeException("Unexpected buffer type " + + buffer.getClass().getName()); + } + private BufferUtil() {} //---------------------------------------------------------------------- diff --git a/src/classes/javax/media/opengl/util/BufferUtil.java.javase b/src/classes/javax/media/opengl/util/BufferUtil.java.javase index f9f6a5d24..2c0652b70 100755 --- a/src/classes/javax/media/opengl/util/BufferUtil.java.javase +++ b/src/classes/javax/media/opengl/util/BufferUtil.java.javase @@ -85,6 +85,25 @@ public class BufferUtil { return -1; } + public static final int sizeOfBufferElem(Buffer buffer) { + if (buffer == null) { + return 0; + } + if (buffer instanceof ByteBuffer) { + return BufferUtil.SIZEOF_BYTE; + } else if (buffer instanceof IntBuffer) { + return BufferUtil.SIZEOF_INT; + } else if (buffer instanceof ShortBuffer) { + return BufferUtil.SIZEOF_SHORT; + } else if (buffer instanceof FloatBuffer) { + return BufferUtil.SIZEOF_FLOAT; + } else if (buffer instanceof DoubleBuffer) { + return BufferUtil.SIZEOF_DOUBLE; + } + throw new RuntimeException("Unexpected buffer type " + + buffer.getClass().getName()); + } + private BufferUtil() {} //---------------------------------------------------------------------- |