diff options
author | Kenneth Russel <[email protected]> | 2005-02-07 23:25:39 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-02-07 23:25:39 +0000 |
commit | e8c5222ee9ab261ed996b2352d1d9a64f76f51fb (patch) | |
tree | d6aaf9b5b0c1c6b2e5185e6f1b3aa89916cef2c5 /src | |
parent | 95beedbd90d58ef595fa8d2048cc41f805923c92 (diff) |
Added JRefract demo to jogl-demos web page
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@48 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src')
-rw-r--r-- | src/demos/vertexProgRefract/VertexProgRefract.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java index cee2054..9698413 100644 --- a/src/demos/vertexProgRefract/VertexProgRefract.java +++ b/src/demos/vertexProgRefract/VertexProgRefract.java @@ -508,6 +508,7 @@ 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: { @@ -530,9 +531,24 @@ public class VertexProgRefract { throw new RuntimeException("Unsupported image type " + img.getType()); } + + // ByteBuffer destScaled = ByteBuffer.allocateDirect(dest.capacity() / 4); + ByteBuffer destScaled = ByteBuffer.allocateDirect(dest.capacity()); + destScaled.order(ByteOrder.nativeOrder()); + int res = glu.gluScaleImage(GL.GL_RGB, + img.getWidth(), img.getHeight(), GL.GL_UNSIGNED_BYTE, dest, + img.getWidth(), img.getHeight(), GL.GL_UNSIGNED_BYTE, destScaled); + // System.out.println("gluScaleImage: result = " + res); + + + + if (mipmapped) { + // glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB, + // GL.GL_UNSIGNED_BYTE, dest); + glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB, - GL.GL_UNSIGNED_BYTE, dest); + GL.GL_UNSIGNED_BYTE, destScaled); } else { gl.glTexImage2D(target, 0, GL.GL_RGB, img.getWidth(), img.getHeight(), 0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, dest); |