From 6873f65775af236ed270fcbd08661f5b53ba3598 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Mon, 24 Oct 2005 19:21:28 +0000 Subject: Merged JSR-231 branch on to the main JOGL trunk. The main trunk now contains the evolving JSR-231 Reference Implementation and the JSR-231 branch is permanently closed. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@144 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/hdr/HDRTexture.java | 60 ++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 29 deletions(-) (limited to 'src/demos/hdr/HDRTexture.java') diff --git a/src/demos/hdr/HDRTexture.java b/src/demos/hdr/HDRTexture.java index fcaac11..b2fa935 100755 --- a/src/demos/hdr/HDRTexture.java +++ b/src/demos/hdr/HDRTexture.java @@ -1,8 +1,10 @@ package demos.hdr; import java.io.*; +import java.nio.*; -import net.java.games.jogl.*; +import javax.media.opengl.*; +import com.sun.opengl.utils.*; public class HDRTexture { private RGBE.Header header; @@ -94,7 +96,7 @@ public class HDRTexture { public int create2DTextureRGBE(GL gl, int targetTextureType) { m_target = targetTextureType; int[] tmp = new int[1]; - gl.glGenTextures(1, tmp); + gl.glGenTextures(1, tmp, 0); int texid = tmp[1]; gl.glBindTexture(m_target, texid); @@ -106,7 +108,7 @@ public class HDRTexture { gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); gl.glTexParameteri(m_target, GL.GL_GENERATE_MIPMAP_SGIS, GL.GL_TRUE); - gl.glTexImage2D(m_target, 0, GL.GL_RGBA, m_width, m_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, m_data); + gl.glTexImage2D(m_target, 0, GL.GL_RGBA, m_width, m_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap(m_data)); return texid; } @@ -114,7 +116,7 @@ public class HDRTexture { public int create2DTextureHILO(GL gl, int targetTextureType, boolean rg) { m_target = targetTextureType; int[] tmp = new int[1]; - gl.glGenTextures(1, tmp); + gl.glGenTextures(1, tmp, 0); int texid = tmp[0]; gl.glBindTexture(m_target, texid); @@ -143,7 +145,7 @@ public class HDRTexture { } } - gl.glTexImage2D(m_target, 0, GL.GL_HILO16_NV, m_width, m_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, img); + gl.glTexImage2D(m_target, 0, GL.GL_HILO16_NV, m_width, m_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, FloatBuffer.wrap(img)); return texid; } @@ -155,9 +157,9 @@ public class HDRTexture { int face_height = m_height / 4; byte[] face = new byte[face_width * face_height * 4]; - m_target = GL.GL_TEXTURE_CUBE_MAP_ARB; + m_target = GL.GL_TEXTURE_CUBE_MAP; int[] tmp = new int[1]; - gl.glGenTextures(1, tmp); + gl.glGenTextures(1, tmp, 0); int texid = tmp[0]; gl.glBindTexture(m_target, texid); @@ -184,7 +186,7 @@ public class HDRTexture { face[ptr++] = m_data[src++]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap(face)); // positive X ptr = 0; @@ -197,7 +199,7 @@ public class HDRTexture { face[ptr++] = m_data[src++]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap(face)); // negative Z ptr = 0; @@ -210,7 +212,7 @@ public class HDRTexture { face[ptr++] = m_data[src++]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap(face)); // negative X ptr = 0; @@ -223,7 +225,7 @@ public class HDRTexture { face[ptr++] = m_data[src++]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap(face)); // negative Y ptr = 0; @@ -236,7 +238,7 @@ public class HDRTexture { face[ptr++] = m_data[src++]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap(face)); // positive Z ptr = 0; @@ -249,7 +251,7 @@ public class HDRTexture { face[ptr++] = m_data[src++]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL.GL_RGBA, face_width, face_height, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, ByteBuffer.wrap(face)); return texid; } @@ -260,9 +262,9 @@ public class HDRTexture { int face_height = m_height / 4; float[] face = new float [face_width * face_height * 2]; - m_target = GL.GL_TEXTURE_CUBE_MAP_ARB; + m_target = GL.GL_TEXTURE_CUBE_MAP; int[] tmp = new int[1]; - gl.glGenTextures(1, tmp); + gl.glGenTextures(1, tmp, 0); int texid = tmp[0]; gl.glBindTexture(m_target, texid); @@ -290,7 +292,7 @@ public class HDRTexture { } } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, FloatBuffer.wrap(face)); // positive X ptr = 0; @@ -306,7 +308,7 @@ public class HDRTexture { } } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, FloatBuffer.wrap(face)); // negative Z ptr = 0; @@ -322,7 +324,7 @@ public class HDRTexture { } } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, FloatBuffer.wrap(face)); // negative X ptr = 0; @@ -338,7 +340,7 @@ public class HDRTexture { } } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, FloatBuffer.wrap(face)); // negative Y ptr = 0; @@ -354,7 +356,7 @@ public class HDRTexture { } } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, FloatBuffer.wrap(face)); // positive Z ptr = 0; @@ -370,7 +372,7 @@ public class HDRTexture { } } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL.GL_HILO16_NV, face_width, face_height, 0, GL.GL_HILO_NV, GL.GL_FLOAT, FloatBuffer.wrap(face)); return texid; } @@ -381,9 +383,9 @@ public class HDRTexture { int face_height = m_height / 4; float[] face = new float [face_width * face_height * 3]; - m_target = GL.GL_TEXTURE_CUBE_MAP_ARB; + m_target = GL.GL_TEXTURE_CUBE_MAP; int[] tmp = new int[1]; - gl.glGenTextures(1, tmp); + gl.glGenTextures(1, tmp, 0); int texid = tmp[0]; gl.glBindTexture(m_target, texid); @@ -407,7 +409,7 @@ public class HDRTexture { face[ptr++] = m_floatdata[src + 2]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, FloatBuffer.wrap(face)); // positive X ptr = 0; @@ -419,7 +421,7 @@ public class HDRTexture { face[ptr++] = m_floatdata[src + 2]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, FloatBuffer.wrap(face)); // negative Z ptr = 0; @@ -431,7 +433,7 @@ public class HDRTexture { face[ptr++] = m_floatdata[src + 2]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, FloatBuffer.wrap(face)); // negative X ptr = 0; @@ -443,7 +445,7 @@ public class HDRTexture { face[ptr++] = m_floatdata[src + 2]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, FloatBuffer.wrap(face)); // negative Y ptr = 0; @@ -455,7 +457,7 @@ public class HDRTexture { face[ptr++] = m_floatdata[src + 2]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, FloatBuffer.wrap(face)); // positive Z ptr = 0; @@ -467,7 +469,7 @@ public class HDRTexture { face[ptr++] = m_floatdata[src + 2]; } } - gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, face); + gl.glTexImage2D(GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, format, face_width, face_height, 0, GL.GL_RGB, GL.GL_FLOAT, FloatBuffer.wrap(face)); return texid; } -- cgit v1.2.3