aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/util/texture/TextureData.java
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/com/sun/opengl/util/texture/TextureData.java
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/com/sun/opengl/util/texture/TextureData.java')
-rwxr-xr-xsrc/classes/com/sun/opengl/util/texture/TextureData.java19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/classes/com/sun/opengl/util/texture/TextureData.java b/src/classes/com/sun/opengl/util/texture/TextureData.java
index 5316ed191..dcaee52f2 100755
--- a/src/classes/com/sun/opengl/util/texture/TextureData.java
+++ b/src/classes/com/sun/opengl/util/texture/TextureData.java
@@ -319,25 +319,18 @@ public class TextureData {
public void flush();
}
+ public String toString() {
+ return "TextureData["+width+"x"+height+", internFormat "+internalFormat+", pixelFormat "+pixelFormat+", pixelType "+pixelType+", border "+border+", estSize "+estimatedMemorySize+", alignment "+alignment+", rowlen "+rowLength;
+ }
+
//----------------------------------------------------------------------
// Internals only below this point
//
- protected int estimatedMemorySize(Buffer buffer) {
+ protected static int estimatedMemorySize(Buffer buffer) {
if (buffer == null) {
return 0;
}
- int capacity = buffer.capacity();
- if (buffer instanceof ByteBuffer) {
- return capacity;
- } else if (buffer instanceof IntBuffer) {
- return capacity * BufferUtil.SIZEOF_INT;
- } else if (buffer instanceof FloatBuffer) {
- return capacity * BufferUtil.SIZEOF_FLOAT;
- } else if (buffer instanceof ShortBuffer) {
- return capacity * BufferUtil.SIZEOF_SHORT;
- }
- throw new RuntimeException("Unexpected buffer type " +
- buffer.getClass().getName());
+ return buffer.capacity() * BufferUtil.sizeOfBufferElem(buffer);
}
}