summaryrefslogtreecommitdiffstats
path: root/src/demos/vertexProgRefract
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-07-07 22:50:13 +0000
committerKenneth Russel <[email protected]>2005-07-07 22:50:13 +0000
commit3cce9fefe99b2a9fe7372c5be21ba7a49f98bf66 (patch)
treef1c260f62b6659b9fb5fa6d96e4c8723e4fc55d7 /src/demos/vertexProgRefract
parent9d278dff86c07218ff2616745381ccc2689f8ea5 (diff)
Merged with main trunk (tag JOGL_PRE_1_1_1)
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@98 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/vertexProgRefract')
-rw-r--r--src/demos/vertexProgRefract/VertexProgRefract.java30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java
index 4039fad..e9c6905 100644
--- a/src/demos/vertexProgRefract/VertexProgRefract.java
+++ b/src/demos/vertexProgRefract/VertexProgRefract.java
@@ -514,37 +514,35 @@ public class VertexProgRefract {
}
private void makeRGBTexture(GL gl, GLU glu, BufferedImage img, int target, boolean mipmapped) {
- ByteBuffer dest = null;
-
switch (img.getType()) {
case BufferedImage.TYPE_3BYTE_BGR:
case BufferedImage.TYPE_CUSTOM: {
byte[] data = ((DataBufferByte) img.getRaster().getDataBuffer()).getData();
- dest = ByteBuffer.allocateDirect(data.length);
- dest.order(ByteOrder.nativeOrder());
- dest.put(data, 0, data.length);
+ if (mipmapped) {
+ glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB,
+ GL.GL_UNSIGNED_BYTE, data);
+ } else {
+ gl.glTexImage2D(target, 0, GL.GL_RGB, img.getWidth(), img.getHeight(), 0,
+ GL.GL_RGB, GL.GL_UNSIGNED_BYTE, data);
+ }
break;
}
case BufferedImage.TYPE_INT_RGB: {
int[] data = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
- dest = ByteBuffer.allocateDirect(data.length * BufferUtils.SIZEOF_INT);
- dest.order(ByteOrder.nativeOrder());
- dest.asIntBuffer().put(data, 0, data.length);
+ if (mipmapped) {
+ glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB,
+ GL.GL_UNSIGNED_BYTE, data);
+ } else {
+ gl.glTexImage2D(target, 0, GL.GL_RGB, img.getWidth(), img.getHeight(), 0,
+ GL.GL_RGB, GL.GL_UNSIGNED_BYTE, data);
+ }
break;
}
default:
throw new RuntimeException("Unsupported image type " + img.getType());
}
-
- if (mipmapped) {
- glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB,
- GL.GL_UNSIGNED_BYTE, dest);
- } else {
- gl.glTexImage2D(target, 0, GL.GL_RGB, img.getWidth(), img.getHeight(), 0,
- GL.GL_RGB, GL.GL_UNSIGNED_BYTE, dest);
- }
}
private void initExtension(GL gl, String glExtensionName) {