aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/javax/media/opengl/util/BufferUtil.java.javase
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-09-02 05:33:27 +0000
committerSven Gothel <[email protected]>2008-09-02 05:33:27 +0000
commit6e14457eac32f838fcdfe9b4b4e26fe7a7d13936 (patch)
tree6b1396b4c6d7a5bf891cf78c0c42cb27b830426b /src/classes/javax/media/opengl/util/BufferUtil.java.javase
parentc7e5336fe362e721fdafdf55e1304b63b33026fc (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/BufferUtil.java.javase')
-rwxr-xr-xsrc/classes/javax/media/opengl/util/BufferUtil.java.javase19
1 files changed, 19 insertions, 0 deletions
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() {}
//----------------------------------------------------------------------