diff options
Diffstat (limited to 'src/demos')
-rw-r--r-- | src/demos/gears/Gears.java | 17 | ||||
-rwxr-xr-x | src/demos/hdr/HDR.java | 78 | ||||
-rwxr-xr-x | src/demos/hdr/HDRTexture.java | 42 | ||||
-rw-r--r-- | src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java | 32 | ||||
-rw-r--r-- | src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java | 2 | ||||
-rw-r--r-- | src/demos/proceduralTexturePhysics/Water.java | 118 | ||||
-rw-r--r-- | src/demos/util/SGIImage.java | 4 | ||||
-rw-r--r-- | src/demos/util/TGAImage.java | 6 | ||||
-rw-r--r-- | src/demos/vertexBufferObject/VertexBufferObject.java | 6 | ||||
-rw-r--r-- | src/demos/vertexProgRefract/VertexProgRefract.java | 54 |
10 files changed, 172 insertions, 187 deletions
diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index 55bbe15..3e8bd44 100644 --- a/src/demos/gears/Gears.java +++ b/src/demos/gears/Gears.java @@ -102,22 +102,7 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR)); System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); - System.err.println(); - System.err.println("glLoadTransposeMatrixfARB() supported: " + - gl.isFunctionAvailable("glLoadTransposeMatrixfARB")); - if (!gl.isFunctionAvailable("glLoadTransposeMatrixfARB")) { - // --- not using extensions - gl.glLoadIdentity(); - } else { - // --- using extensions - final float[] identityTranspose = new float[] { - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - }; - gl.glLoadTransposeMatrixfARB(identityTranspose, 0); - } + gl.glLoadIdentity(); gl.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java index e86218c..b7467da 100755 --- a/src/demos/hdr/HDR.java +++ b/src/demos/hdr/HDR.java @@ -243,7 +243,7 @@ public class HDR implements GLEventListener { GL gl = drawable.getGL(); GLU glu = drawable.getGLU(); - checkExtension(gl, "GL_ARB_multitexture"); + checkExtension(gl, "GL_VERSION_1_3"); // For multitexture checkExtension(gl, "GL_ARB_pbuffer"); checkExtension(gl, "GL_ARB_vertex_program"); checkExtension(gl, "GL_ARB_fragment_program"); @@ -405,7 +405,7 @@ public class HDR implements GLEventListener { // display in window gl.glEnable(GL.GL_TEXTURE_RECTANGLE_NV); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_RECTANGLE_NV, tonemap_pbuffer_tex); if (b['n']) { gl.glTexParameteri( GL.GL_TEXTURE_RECTANGLE_NV, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); @@ -643,10 +643,10 @@ public class HDR implements GLEventListener { gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); if (b['m']) { - gl.glEnable(GL.GL_MULTISAMPLE_ARB); + gl.glEnable(GL.GL_MULTISAMPLE); gl.glHint(GL.GL_MULTISAMPLE_FILTER_HINT_NV, GL.GL_NICEST); } else { - gl.glDisable(GL.GL_MULTISAMPLE_ARB); + gl.glDisable(GL.GL_MULTISAMPLE); } if (!b['e']) { @@ -685,32 +685,32 @@ public class HDR implements GLEventListener { view.xformPt(eyePos_eye, eyePos_model); pipeline.setVertexProgramParameter3f(gl, eyePos_param, eyePos_model.x(), eyePos_model.y(), eyePos_model.z()); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, hdr_tex); - gl.glEnable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, hdr_tex); + gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); boolean linear = b['l']; if (linear) { - gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); - gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); + gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); + gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); } else { - // glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST_MIPMAP_NEAREST); - gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); - gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); + // glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST_MIPMAP_NEAREST); + gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); } if (hilo) { - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, hdr_tex2); - gl.glEnable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, hdr_tex2); + gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); if (linear) { - gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); - gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); + gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); + gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); } else { - // glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST_MIPMAP_NEAREST); - gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); - gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); + // glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST_MIPMAP_NEAREST); + gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + gl.glTexParameteri( GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); } } @@ -773,7 +773,7 @@ public class HDR implements GLEventListener { // horizontal blur gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, blurh_fprog); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); pipeline.bindTexture(gl, blur2_pbuffer_tex); glowPass(gl); @@ -808,7 +808,7 @@ public class HDR implements GLEventListener { pipeline.enableFragmentProgram(gl, shrink_fprog); setOrthoProjection(gl, blur_w, blur_h); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_RECTANGLE_NV, pbuffer_tex); drawQuadRect2(gl, blur_w, blur_h, pbuffer_w, pbuffer_h); pipeline.disableFragmentProgram(gl); @@ -817,7 +817,7 @@ public class HDR implements GLEventListener { // vertical blur gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, blurv_fprog); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); pipeline.bindTexture(gl, blur_pbuffer_tex); glowPass(gl); @@ -893,10 +893,10 @@ public class HDR implements GLEventListener { private void drawQuadRect(GL gl, int w, int h) { gl.glBegin(GL.GL_QUADS); - gl.glTexCoord2f(0, h); gl.glMultiTexCoord2fARB(GL.GL_TEXTURE1_ARB, 0, h / blur_scale); gl.glVertex3f(0, h, 0); - gl.glTexCoord2f(w, h); gl.glMultiTexCoord2fARB(GL.GL_TEXTURE1_ARB, w / blur_scale, h / blur_scale); gl.glVertex3f(w, h, 0); - gl.glTexCoord2f(w, 0); gl.glMultiTexCoord2fARB(GL.GL_TEXTURE1_ARB, w / blur_scale, 0); gl.glVertex3f(w, 0, 0); - gl.glTexCoord2f(0, 0); gl.glMultiTexCoord2fARB(GL.GL_TEXTURE1_ARB, 0, 0); gl.glVertex3f(0, 0, 0); + gl.glTexCoord2f(0, h); gl.glMultiTexCoord2f(GL.GL_TEXTURE1, 0, h / blur_scale); gl.glVertex3f(0, h, 0); + gl.glTexCoord2f(w, h); gl.glMultiTexCoord2f(GL.GL_TEXTURE1, w / blur_scale, h / blur_scale); gl.glVertex3f(w, h, 0); + gl.glTexCoord2f(w, 0); gl.glMultiTexCoord2f(GL.GL_TEXTURE1, w / blur_scale, 0); gl.glVertex3f(w, 0, 0); + gl.glTexCoord2f(0, 0); gl.glMultiTexCoord2f(GL.GL_TEXTURE1, 0, 0); gl.glVertex3f(0, 0, 0); gl.glEnd(); } @@ -933,18 +933,18 @@ public class HDR implements GLEventListener { // draw cubemap background private void drawSkyBox(GL gl) { - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, hdr_tex); - gl.glEnable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, hdr_tex); + gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); if (hilo) { - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, hdr_tex2); - gl.glEnable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, hdr_tex2); + gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); } // initialize object linear texgen - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); gl.glLoadIdentity(); @@ -974,7 +974,7 @@ public class HDR implements GLEventListener { glut.glutSolidCube(gl, 1.0f); gl.glPopMatrix(); - gl.glDisable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); gl.glMatrixMode(GL.GL_TEXTURE); gl.glPopMatrix(); @@ -987,18 +987,18 @@ public class HDR implements GLEventListener { private void toneMappingPass(GL gl) { gl.glFinish(); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_RECTANGLE_NV, pbuffer_tex); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); if (blur2_pbuffer != null) { gl.glBindTexture(GL.GL_TEXTURE_RECTANGLE_NV, blur2_pbuffer_tex); } - gl.glActiveTextureARB(GL.GL_TEXTURE2_ARB); + gl.glActiveTexture(GL.GL_TEXTURE2); gl.glBindTexture(GL.GL_TEXTURE_1D, gamma_tex); - gl.glActiveTextureARB(GL.GL_TEXTURE3_ARB); + gl.glActiveTexture(GL.GL_TEXTURE3); pipeline.bindTexture(gl, vignette_tex); pipeline.enableFragmentProgram(gl, tonemap_fprog); diff --git a/src/demos/hdr/HDRTexture.java b/src/demos/hdr/HDRTexture.java index 1a39cbf..b2fa935 100755 --- a/src/demos/hdr/HDRTexture.java +++ b/src/demos/hdr/HDRTexture.java @@ -157,7 +157,7 @@ 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, 0); int texid = tmp[0]; @@ -186,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, ByteBuffer.wrap(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; @@ -199,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, ByteBuffer.wrap(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; @@ -212,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, ByteBuffer.wrap(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; @@ -225,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, ByteBuffer.wrap(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; @@ -238,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, ByteBuffer.wrap(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; @@ -251,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, ByteBuffer.wrap(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; } @@ -262,7 +262,7 @@ 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, 0); int texid = tmp[0]; @@ -292,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, FloatBuffer.wrap(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; @@ -308,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, FloatBuffer.wrap(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; @@ -324,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, FloatBuffer.wrap(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; @@ -340,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, FloatBuffer.wrap(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; @@ -356,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, FloatBuffer.wrap(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; @@ -372,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, FloatBuffer.wrap(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; } @@ -383,7 +383,7 @@ 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, 0); int texid = tmp[0]; @@ -409,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, FloatBuffer.wrap(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; @@ -421,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, FloatBuffer.wrap(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; @@ -433,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, FloatBuffer.wrap(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; @@ -445,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, FloatBuffer.wrap(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; @@ -457,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, FloatBuffer.wrap(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; @@ -469,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, FloatBuffer.wrap(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; } diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index 3bd6ec3..dcffc3a 100644 --- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java +++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java @@ -176,7 +176,7 @@ public class HWShadowmapsSimple implements GLEventListener { glut = new GLUT(); try { - checkExtension(gl, "GL_ARB_multitexture"); + checkExtension(gl, "GL_VERSION_1_3"); // For multitexture checkExtension(gl, "GL_ARB_depth_texture"); checkExtension(gl, "GL_ARB_shadow"); checkExtension(gl, "GL_ARB_pbuffer"); @@ -561,7 +561,7 @@ public class HWShadowmapsSimple implements GLEventListener { } private void render_quad(GL gl) { - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); obj_linear_texgen(gl); texgen(gl, true); gl.glMatrixMode(GL.GL_TEXTURE); @@ -628,7 +628,7 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glPopMatrix(); // spot image - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glPushMatrix(); applyTransform(gl, cameraInverseTransform); @@ -648,7 +648,7 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glEnable(GL.GL_TEXTURE_2D); gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); @@ -656,9 +656,9 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glMatrixMode(GL.GL_MODELVIEW); render_scene(gl, cameraTransform, drawable, params); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glDisable(GL.GL_TEXTURE_2D); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); render_manipulators(gl, cameraTransform, drawable, params); @@ -675,7 +675,7 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glPopMatrix(); // spot image - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glPushMatrix(); applyTransform(gl, cameraInverseTransform); @@ -696,7 +696,7 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); // depth compare - gl.glActiveTextureARB(GL.GL_TEXTURE2_ARB); + gl.glActiveTexture(GL.GL_TEXTURE2); gl.glPushMatrix(); applyTransform(gl, cameraInverseTransform); @@ -716,7 +716,7 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glEnable(GL.GL_TEXTURE_2D); gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); @@ -725,11 +725,11 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glMatrixMode(GL.GL_MODELVIEW); render_scene(gl, cameraTransform, drawable, params); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glDisable(GL.GL_TEXTURE_2D); - gl.glActiveTextureARB(GL.GL_TEXTURE2_ARB); + gl.glActiveTexture(GL.GL_TEXTURE2); gl.glDisable(GL.GL_TEXTURE_2D); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); render_manipulators(gl, cameraTransform, drawable, params); @@ -752,7 +752,7 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glPopMatrix(); // spot image - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glPushMatrix(); eye_linear_texgen(gl); @@ -770,7 +770,7 @@ public class HWShadowmapsSimple implements GLEventListener { gl.glEnable(GL.GL_TEXTURE_2D); gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glViewport(0, 0, TEX_SIZE, TEX_SIZE); gl.glMatrixMode(GL.GL_PROJECTION); @@ -781,9 +781,9 @@ public class HWShadowmapsSimple implements GLEventListener { largest_square_power_of_two_viewport(gl, drawable); render_scene(gl, spotlightTransform, null, null); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glDisable(GL.GL_TEXTURE_2D); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); } private static void getRow(Mat4f m, int row, float[] out) { diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java index 17084a6..b1d52c5 100644 --- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java +++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java @@ -128,7 +128,7 @@ public class ProceduralTexturePhysics implements GLEventListener { gl.setSwapInterval(1); try { - checkExtension(gl, "GL_ARB_multitexture"); + checkExtension(gl, "GL_VERSION_1_3"); // For multitexture checkExtension(gl, "GL_ARB_vertex_program"); checkExtension(gl, "GL_ARB_fragment_program"); checkExtension(gl, "GL_ARB_pbuffer"); diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index 68c6c93..16b520f 100644 --- a/src/demos/proceduralTexturePhysics/Water.java +++ b/src/demos/proceduralTexturePhysics/Water.java @@ -236,7 +236,7 @@ public class Water { } else { gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glEnable(GL.GL_TEXTURE_2D); } @@ -255,38 +255,38 @@ public class Water { gl.glCallList(displayListIDs[CA_FRAGMENT_PROGRAM_REFLECT]); // Draw quad over full display - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_NORMAL_MAP]); gl.glDisable(GL.GL_TEXTURE_2D); - gl.glActiveTextureARB(GL.GL_TEXTURE3_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, staticTextureIDs[CA_TEXTURE_CUBEMAP]); + gl.glActiveTexture(GL.GL_TEXTURE3); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, staticTextureIDs[CA_TEXTURE_CUBEMAP]); gl.glEnable(GL.GL_TEXTURE_2D); gl.glColor4f(1, 1, 1, 1); gl.glBegin(GL.GL_QUADS); - gl.glMultiTexCoord2fARB(GL.GL_TEXTURE0_ARB, 0,0); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE1_ARB, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), 1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE2_ARB, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), 1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE3_ARB, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); + gl.glMultiTexCoord2f(GL.GL_TEXTURE0, 0,0); + gl.glMultiTexCoord4f(GL.GL_TEXTURE1, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), 1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE2, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), 1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE3, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); gl.glVertex2f(-1,-1); - gl.glMultiTexCoord2fARB(GL.GL_TEXTURE0_ARB, 1,0); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE1_ARB, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), -1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE2_ARB, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), 1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE3_ARB, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); + gl.glMultiTexCoord2f(GL.GL_TEXTURE0, 1,0); + gl.glMultiTexCoord4f(GL.GL_TEXTURE1, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), -1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE2, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), 1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE3, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); gl.glVertex2f( 1,-1); - gl.glMultiTexCoord2fARB(GL.GL_TEXTURE0_ARB, 1,1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE1_ARB, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), -1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE2_ARB, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), -1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE3_ARB, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); + gl.glMultiTexCoord2f(GL.GL_TEXTURE0, 1,1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE1, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), -1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE2, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), -1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE3, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); gl.glVertex2f( 1, 1); - gl.glMultiTexCoord2fARB(GL.GL_TEXTURE0_ARB, 0,1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE1_ARB, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), 1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE2_ARB, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), -1); - gl.glMultiTexCoord4fARB(GL.GL_TEXTURE3_ARB, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); + gl.glMultiTexCoord2f(GL.GL_TEXTURE0, 0,1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE1, matRot.get(0,0), matRot.get(0,1), matRot.get(0,2), 1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE2, matRot.get(1,0), matRot.get(1,1), matRot.get(1,2), -1); + gl.glMultiTexCoord4f(GL.GL_TEXTURE3, matRot.get(2,0), matRot.get(2,1), matRot.get(2,2), 1); gl.glVertex2f(-1, 1); gl.glEnd(); @@ -298,7 +298,7 @@ public class Water { case CA_FULLSCREEN_NORMALMAP: { // Draw quad over full display - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_NORMAL_MAP]); gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]); @@ -307,7 +307,7 @@ public class Water { case CA_FULLSCREEN_HEIGHT: { // Draw quad over full display - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, texHeightOutput); gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]); @@ -316,7 +316,7 @@ public class Water { case CA_FULLSCREEN_FORCE: { // Draw quad over full display - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_FORCE_TARGET]); gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]); @@ -326,7 +326,7 @@ public class Water { case CA_TILED_THREE_WINDOWS: { // Draw quad over full display // lower left - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_FORCE_TARGET]); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); @@ -681,7 +681,7 @@ public class Water { gl.glClear(GL.GL_COLOR_BUFFER_BIT); // Now we need to copy the resulting pixels into the intermediate force field texture - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, texVelocityInput); // use CopyTexSubImage for speed (even though we copy all of it) since we pre-allocated the texture @@ -726,7 +726,7 @@ public class Water { // set current source texture for stage 0 texture for (int i = 0; i < 4; i++) { - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB + i); + gl.glActiveTexture(GL.GL_TEXTURE0 + i); gl.glBindTexture(GL.GL_TEXTURE_2D, texHeightInput); gl.glEnable(GL.GL_TEXTURE_2D); } @@ -751,7 +751,7 @@ public class Water { gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); // Now we need to copy the resulting pixels into the intermediate force field texture - gl.glActiveTextureARB(GL.GL_TEXTURE2_ARB); + gl.glActiveTexture(GL.GL_TEXTURE2); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_FORCE_INTERMEDIATE]); // use CopyTexSubImage for speed (even though we copy all of it) since we pre-allocated the texture @@ -780,7 +780,7 @@ public class Water { gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, wrapMode); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapMode); - gl.glActiveTextureARB(GL.GL_TEXTURE3_ARB); + gl.glActiveTexture(GL.GL_TEXTURE3); gl.glDisable(GL.GL_TEXTURE_2D); // vertex program already bound. @@ -793,7 +793,7 @@ public class Water { gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); // Now we need to copy the resulting pixels into the intermediate force field texture - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_FORCE_TARGET]); // use CopyTexSubImage for speed (even though we copy all of it) since we pre-allocated the texture @@ -810,13 +810,13 @@ public class Water { // bind the vertex program to be used for this step and the next one. - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, texVelocityInput); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_FORCE_TARGET]); - gl.glActiveTextureARB(GL.GL_TEXTURE2_ARB); + gl.glActiveTexture(GL.GL_TEXTURE2); gl.glDisable(GL.GL_TEXTURE_2D); - gl.glActiveTextureARB(GL.GL_TEXTURE3_ARB); + gl.glActiveTexture(GL.GL_TEXTURE3); gl.glDisable(GL.GL_TEXTURE_2D); // Draw the quad to add in force. @@ -845,7 +845,7 @@ public class Water { } // Now we need to copy the resulting pixels into the velocity texture - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glBindTexture(GL.GL_TEXTURE_2D, texVelocityOutput); // use CopyTexSubImage for speed (even though we copy all of it) since we pre-allocated the texture @@ -856,9 +856,9 @@ public class Water { gl.glCallList(displayListIDs[CA_FRAGMENT_PROGRAM_APPLY_VELOCITY]); gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, texHeightInput); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); // velocity output already bound + gl.glActiveTexture(GL.GL_TEXTURE1); // velocity output already bound gl.glEnable(GL.GL_TEXTURE_2D); // use offsets of zero @@ -870,7 +870,7 @@ public class Water { gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); // Now we need to copy the resulting pixels into the input height texture - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, texHeightInput); // use CopyTexSubImage for speed (even though we copy all of it) since we pre-allocated the texture @@ -882,7 +882,7 @@ public class Water { // offsets with bilinear on for (int i = 1; i < 4; i++) { - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB + i); + gl.glActiveTexture(GL.GL_TEXTURE0 + i); gl.glBindTexture(GL.GL_TEXTURE_2D, texHeightInput); gl.glEnable(GL.GL_TEXTURE_2D); } @@ -902,7 +902,7 @@ public class Water { } // Now we need to copy the resulting pixels into the velocity texture - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, texHeightOutput); // use CopyTexSubImage for speed (even though we copy all of it) since we pre-allocated the texture @@ -933,7 +933,7 @@ public class Water { private void createNormalMap(GL gl) { // use the height output on all four texture stages for (int i = 0; i < 4; i++) { - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB + i); + gl.glActiveTexture(GL.GL_TEXTURE0 + i); gl.glBindTexture(GL.GL_TEXTURE_2D, texHeightOutput); gl.glEnable(GL.GL_TEXTURE_2D); } @@ -960,7 +960,7 @@ public class Water { gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); // Now we need to copy the resulting pixels into the normal map - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, dynamicTextureIDs[CA_TEXTURE_NORMAL_MAP]); // use CopyTexSubImage for speed (even though we copy all of it) since we pre-allocated the texture @@ -970,7 +970,7 @@ public class Water { private void drawInteriorBoundaryObjects(GL gl) { gl.glDisable(GL.GL_REGISTER_COMBINERS_NV); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, staticTextureIDs[CA_TEXTURE_INITIAL_MAP]); gl.glEnable(GL.GL_TEXTURE_2D); @@ -978,7 +978,7 @@ public class Water { // disable other texture units. for (int i = 1; i < 4; i++) { - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB + i); + gl.glActiveTexture(GL.GL_TEXTURE0 + i); gl.glDisable(GL.GL_TEXTURE_2D); } @@ -988,7 +988,7 @@ public class Water { gl.glCallList(displayListIDs[CA_DRAW_SCREEN_QUAD]); if (spinLogo) { - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, staticTextureIDs[CA_TEXTURE_SPIN]); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glPushMatrix(); @@ -1023,27 +1023,27 @@ public class Water { } private void loadCubeMap(GL gl, int id, String filenamePattern, boolean mipmap) { - int[] faces = new int[] { GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB }; + int[] faces = new int[] { GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, + GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, + GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, + GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, + GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, + GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z }; String[] faceNames = new String[] { "posx", "negx", "posy", "negy", "posz", "negz" }; // create and bind a cubemap texture object - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, id); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, id); // enable automipmap generation if needed. - gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_GENERATE_MIPMAP_SGIS, (mipmap ? 1 : 0)); + gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_GENERATE_MIPMAP_SGIS, (mipmap ? 1 : 0)); if (mipmap) - gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); + gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); else - gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); - gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); - gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); - gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); + gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); + gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); + gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); + gl.glTexParameterf(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE); // load 6 faces. MessageFormat fmt = new MessageFormat(filenamePattern); @@ -1191,11 +1191,11 @@ public class Water { gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); gl.glBindTexture(GL.GL_TEXTURE_2D, staticTextureIDs[CA_TEXTURE_DROPLET]); gl.glEnable(GL.GL_TEXTURE_2D); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); gl.glDisable(GL.GL_TEXTURE_2D); gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE); diff --git a/src/demos/util/SGIImage.java b/src/demos/util/SGIImage.java index df36e70..7d4468e 100644 --- a/src/demos/util/SGIImage.java +++ b/src/demos/util/SGIImage.java @@ -132,7 +132,7 @@ public class SGIImage { return header.ysize; } - /** Returns the OpenGL format for this texture; e.g. GL.GL_BGR_EXT or GL.GL_BGRA_EXT. */ + /** Returns the OpenGL format for this texture; e.g. GL.GL_BGR or GL.GL_BGRA. */ public int getFormat() { return format; } @@ -202,7 +202,7 @@ public class SGIImage { rowSize = null; tmpData = null; tmpRead = null; - format = GL.GL_BGRA_EXT; + format = GL.GL_BGRA; } private void getRow(byte[] buf, int y, int z) { diff --git a/src/demos/util/TGAImage.java b/src/demos/util/TGAImage.java index c999c99..a99f4f3 100644 --- a/src/demos/util/TGAImage.java +++ b/src/demos/util/TGAImage.java @@ -272,10 +272,10 @@ public class TGAImage { data = new byte[rawWidth * header.height()]; if (header.pixelDepth() == 24) { - format = GL.GL_BGR_EXT; + format = GL.GL_BGR; } else { assert header.pixelDepth() == 32; - format = GL.GL_BGRA_EXT; + format = GL.GL_BGRA; } for (i = 0; i < header.height(); ++i) { @@ -296,7 +296,7 @@ public class TGAImage { /** Returns the height of the image. */ public int getHeight() { return header.height(); } - /** Returns the OpenGL format for this texture; e.g. GL.GL_BGR_EXT or GL.GL_BGRA_EXT. */ + /** Returns the OpenGL format for this texture; e.g. GL.GL_BGR or GL.GL_BGRA. */ public int getGLFormat() { return format; } /** Returns the raw data for this texture in the correct diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java index 0c33fa1..ee78499 100644 --- a/src/demos/vertexBufferObject/VertexBufferObject.java +++ b/src/demos/vertexBufferObject/VertexBufferObject.java @@ -559,8 +559,8 @@ public class VertexBufferObject implements GLEventListener { int vertexIndex = 0; if (vboEnabled) { - gl.glVertexPointer(3, GL.GL_FLOAT, 6 * SIZEOF_FLOAT, BufferUtils.bufferOffset(buffers[cur].vertexOffset)); - gl.glNormalPointer( GL.GL_FLOAT, 6 * SIZEOF_FLOAT, BufferUtils.bufferOffset(buffers[cur].normalOffset)); + gl.glVertexPointer(3, GL.GL_FLOAT, 6 * SIZEOF_FLOAT, buffers[cur].vertexOffset); + gl.glNormalPointer( GL.GL_FLOAT, 6 * SIZEOF_FLOAT, buffers[cur].normalOffset); } else { gl.glVertexPointer(3, GL.GL_FLOAT, 6 * SIZEOF_FLOAT, v); gl.glNormalPointer( GL.GL_FLOAT, 6 * SIZEOF_FLOAT, buffers[cur].normals); @@ -634,7 +634,7 @@ public class VertexBufferObject implements GLEventListener { for (int i = 0; i < len; i++) { ++numDrawElementsCalls; gl.glDrawElements(primitive, 2 * STRIP_SIZE, GL.GL_UNSIGNED_INT, - BufferUtils.bufferOffset(i * 2 * STRIP_SIZE * BufferUtils.SIZEOF_INT)); + i * 2 * STRIP_SIZE * BufferUtils.SIZEOF_INT); if(getFlag('f')) { gl.glFlush(); } diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java index 3bfd606..18dca1c 100644 --- a/src/demos/vertexProgRefract/VertexProgRefract.java +++ b/src/demos/vertexProgRefract/VertexProgRefract.java @@ -235,7 +235,7 @@ public class VertexProgRefract implements GLEventListener { try { initExtension(gl, "GL_ARB_vertex_program"); - initExtension(gl, "GL_ARB_multitexture"); + initExtension(gl, "GL_VERSION_1_3"); // For multitexturing support if (!gl.isExtensionAvailable("GL_ARB_fragment_program")) { if (gl.isExtensionAvailable("GL_NV_register_combiners")) { useRegisterCombiners = true; @@ -274,10 +274,10 @@ public class VertexProgRefract implements GLEventListener { int[] cubemapTmp = new int[1]; gl.glGenTextures(1, cubemapTmp, 0); cubemap = cubemapTmp[0]; - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, cubemap); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap); - gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); - gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP_ARB, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); + gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); + gl.glTexParameteri(GL.GL_TEXTURE_CUBE_MAP, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); try { loadPNGCubemap(gl, glu, "demos/data/cubemaps/uffizi", true); @@ -382,17 +382,17 @@ public class VertexProgRefract implements GLEventListener { gl.glProgramEnvParameter4fARB(GL.GL_VERTEX_PROGRAM_ARB, 62, fresnel, fresnel, fresnel, 1.0f); // set texture transforms - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, cubemap); - gl.glEnable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap); + gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); gl.glMatrixMode(GL.GL_TEXTURE); gl.glLoadIdentity(); gl.glScalef(1.0f, -1.0f, 1.0f); viewer.updateInverseRotation(gl); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, cubemap); - gl.glEnable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap); + gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); gl.glMatrixMode(GL.GL_TEXTURE); gl.glLoadIdentity(); gl.glScalef(1.0f, -1.0f, 1.0f); @@ -506,12 +506,12 @@ public class VertexProgRefract implements GLEventListener { // Not sure why this is the case. Vertical flip in the image read? Possible, but doesn't // appear to be the case (have tried this and produced wrong results at the time). String[] suffixes = { "posx", "negx", "negy", "posy", "posz", "negz" }; - int[] targets = { GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB }; + int[] targets = { GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, + GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, + GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, + GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, + GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, + GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z }; private void loadPNGCubemap(GL gl, GLU glu, String baseName, boolean mipmapped) throws IOException { for (int i = 0; i < suffixes.length; i++) { String resourceName = baseName + "_" + suffixes[i] + ".png"; @@ -576,9 +576,9 @@ public class VertexProgRefract implements GLEventListener { // combiner 0 // a*b+c*d - gl.glCombinerInputNV(GL.GL_COMBINER0_NV, GL.GL_RGB, GL.GL_VARIABLE_A_NV, GL.GL_TEXTURE0_ARB, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); + gl.glCombinerInputNV(GL.GL_COMBINER0_NV, GL.GL_RGB, GL.GL_VARIABLE_A_NV, GL.GL_TEXTURE0, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); gl.glCombinerInputNV(GL.GL_COMBINER0_NV, GL.GL_RGB, GL.GL_VARIABLE_B_NV, GL.GL_PRIMARY_COLOR_NV, GL.GL_UNSIGNED_INVERT_NV, GL.GL_RGB); - gl.glCombinerInputNV(GL.GL_COMBINER0_NV, GL.GL_RGB, GL.GL_VARIABLE_C_NV, GL.GL_TEXTURE1_ARB, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); + gl.glCombinerInputNV(GL.GL_COMBINER0_NV, GL.GL_RGB, GL.GL_VARIABLE_C_NV, GL.GL_TEXTURE1, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); gl.glCombinerInputNV(GL.GL_COMBINER0_NV, GL.GL_RGB, GL.GL_VARIABLE_D_NV, GL.GL_PRIMARY_COLOR_NV, GL.GL_UNSIGNED_IDENTITY_NV, GL.GL_RGB); // output: @@ -640,22 +640,22 @@ public class VertexProgRefract implements GLEventListener { gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); - gl.glActiveTextureARB(GL.GL_TEXTURE1_ARB); - gl.glDisable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE1); + gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); - gl.glActiveTextureARB(GL.GL_TEXTURE0_ARB); - gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP_ARB, cubemap); - gl.glEnable(GL.GL_TEXTURE_CUBE_MAP_ARB); + gl.glActiveTexture(GL.GL_TEXTURE0); + gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, cubemap); + gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); // This is a workaround for a driver bug on Mac OS X where the // normals are not being sent down to the hardware in - // GL_NORMAL_MAP_EXT texgen mode. Temporarily enabling lighting + // GL_NORMAL_MAP texgen mode. Temporarily enabling lighting // causes the normals to be sent down. Thanks to Ken Dyke. gl.glEnable(GL.GL_LIGHTING); - gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP_EXT); - gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP_EXT); - gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP_EXT); + gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); + gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); + gl.glTexGeni(GL.GL_R, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); gl.glEnable(GL.GL_TEXTURE_GEN_S); gl.glEnable(GL.GL_TEXTURE_GEN_T); |