diff options
author | Kenneth Russel <[email protected]> | 2005-10-24 19:21:28 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-10-24 19:21:28 +0000 |
commit | 6873f65775af236ed270fcbd08661f5b53ba3598 (patch) | |
tree | 6fcefdc3a9429d7d3071b1464c11d40fa7bc3ab9 /src/demos/proceduralTexturePhysics | |
parent | 538be101e7bce7788c82e1b254a66deb5d35bb56 (diff) |
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
Diffstat (limited to 'src/demos/proceduralTexturePhysics')
-rw-r--r-- | src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java | 448 | ||||
-rw-r--r-- | src/demos/proceduralTexturePhysics/Water.java | 217 |
2 files changed, 343 insertions, 322 deletions
diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java index d2a04af..7599778 100644 --- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java +++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java @@ -37,7 +37,9 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; -import net.java.games.jogl.*; +import javax.media.opengl.*; +import com.sun.opengl.utils.*; +import demos.common.*; import demos.util.*; import gleem.*; import gleem.linalg.*; @@ -56,35 +58,19 @@ import gleem.linalg.*; * */ -public class ProceduralTexturePhysics { - private volatile boolean drawing; - private volatile int mousePosX; - private volatile int mousePosY; - - private Dimension dim = new Dimension(); - private GLCanvas canvas; - private Water water; - private Animator animator; - private volatile ExaminerViewer viewer; - private boolean[] b = new boolean[256]; - private boolean doViewAll = true; - private float zNear = 0.1f; - private float zFar = 10.0f; - - private DurationTimer timer = new DurationTimer(); - private boolean firstRender = true; - private int frameCount; - +public class ProceduralTexturePhysics extends Demo { public static void main(String[] args) { - new ProceduralTexturePhysics().run(args); - } - - public void run(String[] args) { - canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); - canvas.addGLEventListener(new Listener()); - canvas.setNoAutoRedrawMode(true); - - animator = new Animator(canvas); + GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); + ProceduralTexturePhysics demo = new ProceduralTexturePhysics(); + canvas.addGLEventListener(demo); + + final Animator animator = new Animator(canvas); + demo.setDemoListener(new DemoListener() { + public void shutdownDemo() { + runExit(animator); + } + public void repaint() {} + }); Frame frame = new Frame("Procedural Texture Waves"); frame.setLayout(new BorderLayout()); @@ -96,16 +82,10 @@ public class ProceduralTexturePhysics { frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - runExit(); + runExit(animator); } }); - water = new Water(); - water.initialize("demos/data/images/nvfixed.tga", - "demos/data/images/nvspin.tga", - "demos/data/images/droplet.tga", - "demos/data/cubemaps/CloudyHills_{0}.tga", - canvas); animator.start(); } @@ -113,49 +93,76 @@ public class ProceduralTexturePhysics { // Internals only below this point // - private void setFlag(char key, boolean val) { - b[((int) key) & 0xFF] = val; + public void shutdownDemo() { + ManipManager.getManipManager().unregisterWindow(drawable); + drawable.removeGLEventListener(this); + super.shutdownDemo(); } - private boolean getFlag(char key) { - return b[((int) key) & 0xFF]; - } + private volatile boolean drawing; + private volatile int mousePosX; + private volatile int mousePosY; - class Listener implements GLEventListener { - private float blurIncrement = 0.01f; - private float bumpIncrement = 0.01f; - private float frequencyIncrement = 0.1f; - - public void init(GLDrawable drawable) { - GL gl = drawable.getGL(); - gl.setSwapInterval(1); - - try { - checkExtension(gl, "GL_ARB_multitexture"); - checkExtension(gl, "GL_ARB_vertex_program"); - checkExtension(gl, "GL_ARB_fragment_program"); - checkExtension(gl, "GL_ARB_pbuffer"); - checkExtension(gl, "GL_ARB_pixel_format"); - } catch (GLException e) { - e.printStackTrace(); - throw(e); - } + private GLAutoDrawable drawable; + private Water water = new Water(); + private volatile ExaminerViewer viewer; + private boolean[] b = new boolean[256]; + private boolean doViewAll = true; + private float zNear = 0.1f; + private float zFar = 10.0f; + + private DurationTimer timer = new DurationTimer(); + private boolean firstRender = true; + private int frameCount; + + private float blurIncrement = 0.01f; + private float bumpIncrement = 0.01f; + private float frequencyIncrement = 0.1f; + + public void init(GLAutoDrawable drawable) { + water.destroy(); + water.initialize("demos/data/images/nvfixed.tga", + "demos/data/images/nvspin.tga", + "demos/data/images/droplet.tga", + "demos/data/cubemaps/CloudyHills_{0}.tga", + drawable); + + GL gl = drawable.getGL(); + gl.setSwapInterval(1); + + try { + 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"); + checkExtension(gl, "GL_ARB_pixel_format"); + } catch (GLException e) { + e.printStackTrace(); + throw(e); + } - gl.glClearColor(0, 0.2f, 0.5f, 0); - gl.glDisable(GL.GL_LIGHTING); - gl.glDisable(GL.GL_DEPTH_TEST); - gl.glDisable(GL.GL_CULL_FACE); + gl.glClearColor(0, 0.2f, 0.5f, 0); + gl.glDisable(GL.GL_LIGHTING); + gl.glDisable(GL.GL_DEPTH_TEST); + gl.glDisable(GL.GL_CULL_FACE); + + doViewAll = true; + + if (firstRender) { + firstRender = false; // Register the window with the ManipManager ManipManager manager = ManipManager.getManipManager(); manager.registerWindow(drawable); + this.drawable = drawable; viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons()); + viewer.setAutoRedrawMode(false); viewer.attach(drawable, new BSphereProvider() { - public BSphere getBoundingSphere() { - return new BSphere(new Vec3f(0, 0, 0), 1.2f); - } - }); + public BSphere getBoundingSphere() { + return new BSphere(new Vec3f(0, 0, 0), 1.2f); + } + }); viewer.setVertFOV((float) (15.0f * Math.PI / 32.0f)); viewer.setZNear(zNear); viewer.setZFar(zFar); @@ -187,175 +194,176 @@ public class ProceduralTexturePhysics { mousePosY = e.getY(); } }); - } - public void display(GLDrawable drawable) { - if (!firstRender) { - if (++frameCount == 30) { - timer.stop(); - System.err.println("Frames per second: " + (30.0f / timer.getDurationAsSeconds())); - timer.reset(); - timer.start(); - frameCount = 0; - } - } else { - firstRender = false; - timer.start(); - } + timer.start(); + } + } - GL gl = drawable.getGL(); - GLU glu = drawable.getGLU(); + public void display(GLAutoDrawable drawable) { + if (++frameCount == 30) { + timer.stop(); + System.err.println("Frames per second: " + (30.0f / timer.getDurationAsSeconds())); + timer.reset(); + timer.start(); + frameCount = 0; + } - gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); + GL gl = drawable.getGL(); - if (doViewAll) { - viewer.viewAll(gl); - doViewAll = false; - } + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - viewer.update(gl); - ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters()); - ManipManager.getManipManager().render(drawable, gl); + if (doViewAll) { + viewer.viewAll(gl); + doViewAll = false; + } - if (drawing) { - canvas.getSize(dim); - water.addDroplet(new Water.Droplet( 2 * (mousePosX / (float) dim.width - 0.5f), - -2 * (mousePosY / (float) dim.height - 0.5f), - 0.08f)); - } - water.tick(); + viewer.update(gl); + ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters()); + ManipManager.getManipManager().render(drawable, gl); - CameraParameters params = viewer.getCameraParameters(); - water.draw(gl, params.getOrientation().inverse()); + if (drawing) { + int w = drawable.getWidth(); + int h = drawable.getHeight(); + water.addDroplet(new Water.Droplet( 2 * (mousePosX / (float) w - 0.5f), + -2 * (mousePosY / (float) h - 0.5f), + 0.08f)); } + water.tick(); - public void reshape(GLDrawable drawable, int x, int y, int width, int height) {} + CameraParameters params = viewer.getCameraParameters(); + water.draw(gl, params.getOrientation().inverse()); + } - // Unused routines - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} - //---------------------------------------------------------------------- - // Internals only below this point - // + // Unused routines + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - private void checkExtension(GL gl, String extensionName) { - if (!gl.isExtensionAvailable(extensionName)) { - String message = "Unable to initialize " + extensionName + " OpenGL extension"; - JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE); - runExit(); - } + private void setFlag(char key, boolean val) { + b[((int) key) & 0xFF] = val; + } + + private boolean getFlag(char key) { + return b[((int) key) & 0xFF]; + } + + private void checkExtension(GL gl, String extensionName) { + if (!gl.isExtensionAvailable(extensionName)) { + String message = "Unable to initialize " + extensionName + " OpenGL extension"; + JOptionPane.showMessageDialog(null, message, "Unavailable extension", JOptionPane.ERROR_MESSAGE); + shutdownDemo(); } + } - private void dispatchKey(char k) { - setFlag(k, !getFlag(k)); - - switch (k) { - case 27: - case 'q': - runExit(); - break; - case 'w': - water.enableWireframe(getFlag('w')); - break; - case 'd': - // FIXME - /* - - if (getKey('d')) { - glutMouseFunc(glh::glut_mouse_function); - glutMotionFunc(glh::glut_motion_function); - } - else - { - glutMouseFunc(Mouse); - glutMotionFunc(Motion); - } - */ - break; - case ' ': - water.enableAnimation(getFlag(' ')); - break; - case 'b': - water.enableBorderWrapping(getFlag('b')); - break; - case 'n': - water.singleStep(); - break; - case 's': - water.enableSlowAnimation(getFlag('s')); - break; - case '1': - water.setRenderMode(Water.CA_FULLSCREEN_REFLECT); - break; - case '2': - water.setRenderMode(Water.CA_FULLSCREEN_HEIGHT); - break; - case '3': - water.setRenderMode(Water.CA_FULLSCREEN_FORCE); - break; - case '4': - water.setRenderMode(Water.CA_FULLSCREEN_NORMALMAP); - break; - case '5': - water.setRenderMode(Water.CA_TILED_THREE_WINDOWS); - break; - case 'r': - water.reset(); - break; - case 'i': - // FIXME: make sure this is what this does - doViewAll = true; - // gluPerspective(90, 1, .01, 10); - break; - case 'c': { - float dist = water.getBlurDistance(); - if (dist > blurIncrement) - water.setBlurDistance(dist - blurIncrement); - break; - } - case 'v': { - float dist = water.getBlurDistance(); - if (dist < 1) - water.setBlurDistance(dist + blurIncrement); - break; - } - case '-': { - float scale = water.getBumpScale(); - if (scale > -1) - water.setBumpScale(scale - bumpIncrement); - break; - } - case '=': { - float scale = water.getBumpScale(); - if (scale < 1) - water.setBumpScale(scale + bumpIncrement); - break; - } - case 'l': - water.enableBoundaryApplication(getFlag('l')); - break; - case 'o': - water.enableSpinningLogo(getFlag('o')); - break; - case '.': { - float frequency = water.getBumpScale(); - if (frequency < 1) - water.setDropFrequency(frequency + frequencyIncrement); - break; - } - case ',': { - float frequency = water.getBumpScale(); - if (frequency > 0) - water.setDropFrequency(frequency - frequencyIncrement); - break; - } - default: - break; + private void dispatchKey(char k) { + setFlag(k, !getFlag(k)); + + switch (k) { + case 27: + case 'q': + shutdownDemo(); + break; + case 'w': + water.enableWireframe(getFlag('w')); + break; + case 'd': + // FIXME + /* + + if (getKey('d')) { + glutMouseFunc(glh::glut_mouse_function); + glutMotionFunc(glh::glut_motion_function); } + else + { + glutMouseFunc(Mouse); + glutMotionFunc(Motion); + } + */ + break; + case ' ': + water.enableAnimation(getFlag(' ')); + break; + case 'b': + water.enableBorderWrapping(getFlag('b')); + break; + case 'n': + water.singleStep(); + break; + case 's': + water.enableSlowAnimation(getFlag('s')); + break; + case '1': + water.setRenderMode(Water.CA_FULLSCREEN_REFLECT); + break; + case '2': + water.setRenderMode(Water.CA_FULLSCREEN_HEIGHT); + break; + case '3': + water.setRenderMode(Water.CA_FULLSCREEN_FORCE); + break; + case '4': + water.setRenderMode(Water.CA_FULLSCREEN_NORMALMAP); + break; + case '5': + water.setRenderMode(Water.CA_TILED_THREE_WINDOWS); + break; + case 'r': + water.reset(); + break; + case 'i': + // FIXME: make sure this is what this does + doViewAll = true; + // gluPerspective(90, 1, .01, 10); + break; + case 'c': { + float dist = water.getBlurDistance(); + if (dist > blurIncrement) + water.setBlurDistance(dist - blurIncrement); + break; + } + case 'v': { + float dist = water.getBlurDistance(); + if (dist < 1) + water.setBlurDistance(dist + blurIncrement); + break; + } + case '-': { + float scale = water.getBumpScale(); + if (scale > -1) + water.setBumpScale(scale - bumpIncrement); + break; } - } + case '=': { + float scale = water.getBumpScale(); + if (scale < 1) + water.setBumpScale(scale + bumpIncrement); + break; + } + case 'l': + water.enableBoundaryApplication(getFlag('l')); + break; + case 'o': + water.enableSpinningLogo(getFlag('o')); + break; + case '.': { + float frequency = water.getBumpScale(); + if (frequency < 1) + water.setDropFrequency(frequency + frequencyIncrement); + break; + } + case ',': { + float frequency = water.getBumpScale(); + if (frequency > 0) + water.setDropFrequency(frequency - frequencyIncrement); + break; + } + default: + break; + } + } - private void runExit() { + private static void runExit(final Animator animator) { // Note: calling System.exit() synchronously inside the draw, // reshape or init callbacks can lead to deadlocks on certain // platforms (in particular, X11) because the JAWT's locking diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index 0522c70..701a10f 100644 --- a/src/demos/proceduralTexturePhysics/Water.java +++ b/src/demos/proceduralTexturePhysics/Water.java @@ -36,11 +36,14 @@ package demos.proceduralTexturePhysics; import java.awt.Image; import java.awt.image.*; import java.io.*; +import java.nio.*; import java.text.*; import java.util.*; import gleem.linalg.*; -import net.java.games.jogl.*; +import javax.media.opengl.*; +import javax.media.opengl.glu.*; +import com.sun.opengl.utils.*; import demos.util.*; /** @@ -60,6 +63,8 @@ public class Water { // used to render the water geometry (with the parent drawable's GL // object). + private GLU glu = new GLU(); + // Rendering modes public static final int CA_FULLSCREEN_REFLECT = 0; public static final int CA_FULLSCREEN_FORCE = 1; @@ -75,7 +80,7 @@ public class Water { private String tmpDropletFilename; private String tmpCubeMapFilenamePattern; - private GLDrawable pbuffer; + private GLPbuffer pbuffer; private Rotf cameraOrientation = new Rotf(); // Static texture names @@ -186,7 +191,7 @@ public class Water { String spinFilename, String dropletFilename, String cubeMapFilenamePattern, - GLDrawable parentWindow) { + GLAutoDrawable parentWindow) { loadInitialTexture(initialMapFilename); tmpSpinFilename = spinFilename; tmpDropletFilename = dropletFilename; @@ -194,17 +199,26 @@ public class Water { // create the pbuffer. Will use this as an offscreen rendering buffer. // it allows rendering a texture larger than our window. - if (!parentWindow.canCreateOffscreenDrawable()) { - throw new GLException("Parent window doesn't support creation of pbuffers"); - } GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); - pbuffer = parentWindow.createOffscreenDrawable(caps, - initialMapDimensions[0], - initialMapDimensions[1]); + if (!GLDrawableFactory.getFactory().canCreateGLPbuffer()) { + throw new GLException("Pbuffers not supported with this graphics card"); + } + pbuffer = GLDrawableFactory.getFactory().createGLPbuffer(caps, + initialMapDimensions[0], + initialMapDimensions[1], + parentWindow.getContext()); pbuffer.addGLEventListener(new Listener()); } + public void destroy() { + if (pbuffer != null) { + pbuffer.destroy(); + pbuffer = null; + } + reset = true; + } + public void tick() { pbuffer.display(); } @@ -223,7 +237,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); } @@ -242,38 +256,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(); @@ -285,7 +299,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]); @@ -294,7 +308,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]); @@ -303,7 +317,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]); @@ -313,7 +327,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(); @@ -408,14 +422,13 @@ public class Water { // class Listener implements GLEventListener { - public void init(GLDrawable drawable) { + public void init(GLAutoDrawable drawable) { GL gl = drawable.getGL(); - GLU glu = drawable.getGLU(); - initOpenGL(gl, glu); + initOpenGL(gl); } - public void display(GLDrawable drawable) { + public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); if (mustUpdateBlurOffsets) { updateBlurVertOffset(gl); @@ -448,10 +461,10 @@ public class Water { } } - public void reshape(GLDrawable drawable, int x, int y, int width, int height) {} + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} // Unused routines - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} } private TGAImage loadImage(String resourceName) { @@ -474,7 +487,7 @@ public class Water { initialMapDimensions[1] = initialMap.getHeight(); } - private void initOpenGL(GL gl, GLU glu) { + private void initOpenGL(GL gl) { loadTextures(gl, tmpSpinFilename, tmpDropletFilename, tmpCubeMapFilenamePattern); tmpSpinFilename = null; tmpDropletFilename = null; @@ -501,7 +514,7 @@ public class Water { /////////////////////////////////////////////////////////////////////////// int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); vertexProgramID = tmpInt[0]; gl.glBindProgramARB(GL.GL_VERTEX_PROGRAM_ARB, vertexProgramID); @@ -581,7 +594,7 @@ public class Water { // set up constants (not currently used in the vertex program, though) float[] rCVConsts = new float[] { 0, 0.5f, 1.0f, 2.0f }; - gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_CONSTS_1, rCVConsts); + gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_CONSTS_1, rCVConsts, 0); loadProgram(gl, GL.GL_VERTEX_PROGRAM_ARB, programBuffer); @@ -668,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 @@ -713,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); } @@ -738,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 @@ -767,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. @@ -780,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 @@ -797,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. @@ -832,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 @@ -843,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 @@ -857,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 @@ -869,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); } @@ -889,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 @@ -920,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); } @@ -929,12 +942,12 @@ public class Water { // Red mask first float[] pixMasks = new float[] { normalSTScale, 0.0f, 0.0f, 0.0f }; - gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, pixMasks); + gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, pixMasks, 0); // Now green mask & scale: pixMasks[0] = 0.0f; pixMasks[1] = normalSTScale; - gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 1, pixMasks); + gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 1, pixMasks, 0); gl.glCallList(displayListIDs[CA_FRAGMENT_PROGRAM_CREATE_NORMAL_MAP]); @@ -947,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 @@ -957,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); @@ -965,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); } @@ -975,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(); @@ -1002,7 +1015,7 @@ public class Water { 0, image.getGLFormat(), GL.GL_UNSIGNED_BYTE, - image.getData()); + ByteBuffer.wrap(image.getData())); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE); @@ -1010,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); @@ -1045,7 +1058,7 @@ public class Water { 0, image.getGLFormat(), GL.GL_UNSIGNED_BYTE, - image.getData()); + ByteBuffer.wrap(image.getData())); } } @@ -1060,8 +1073,8 @@ public class Water { TGAImage spin = loadImage(spinFilename); TGAImage droplet = loadImage(dropletFilename); - gl.glGenTextures(CA_NUM_STATIC_TEXTURES, staticTextureIDs); - gl.glGenTextures(CA_NUM_DYNAMIC_TEXTURES, dynamicTextureIDs); // also create intermediate texture object + gl.glGenTextures(CA_NUM_STATIC_TEXTURES, staticTextureIDs, 0); + gl.glGenTextures(CA_NUM_DYNAMIC_TEXTURES, dynamicTextureIDs, 0); // also create intermediate texture object // upload the initial map texture createTextureObject(gl, staticTextureIDs[CA_TEXTURE_INITIAL_MAP], initialMap, true); @@ -1147,10 +1160,10 @@ public class Water { float type2Offset[] = { type2OffsetX[i], type2OffsetY[i], 0.0f, 0.0f }; float type4Offset[] = { type4OffsetX[i], type4OffsetY[i], 0.0f, 0.0f }; - gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_NO_OFFSET + 5 * i, noOffset); - gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE1 + 5 * i, type1Offset); - gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE2 + 5 * i, type2Offset); - gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE4 + 5 * i, type4Offset); + gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_NO_OFFSET + 5 * i, noOffset, 0); + gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE1 + 5 * i, type1Offset, 0); + gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE2 + 5 * i, type2Offset, 0); + gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE4 + 5 * i, type4Offset, 0); } } @@ -1170,7 +1183,7 @@ public class Water { for (int i = 0; i < 4; ++i) { offsets[0] = blurDist * ( type3OffsetX[i]); offsets[1] = blurDist * ( type3OffsetY[i]); - gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE3 + 5 * i, offsets); + gl.glProgramEnvParameter4fvARB(GL.GL_VERTEX_PROGRAM_ARB, CV_UV_T0_TYPE3 + 5 * i, offsets, 0); } } @@ -1178,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); @@ -1254,7 +1267,7 @@ public class Water { float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f }; int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); int fragProg = tmpInt[0]; gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); @@ -1281,7 +1294,7 @@ public class Water { loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); gl.glNewList(displayListID, GL.GL_COMPILE); - gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0); + gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0); gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB); gl.glEndList(); @@ -1381,7 +1394,7 @@ public class Water { float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f }; int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); int fragProg = tmpInt[0]; gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); @@ -1425,7 +1438,7 @@ public class Water { loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); gl.glNewList(displayListID, GL.GL_COMPILE); - gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0); + gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0); gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB); gl.glEndList(); @@ -1468,7 +1481,7 @@ public class Water { // } int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); int fragProg = tmpInt[0]; gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); @@ -1540,7 +1553,7 @@ public class Water { float[] const1 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f }; int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); int fragProg = tmpInt[0]; gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); @@ -1566,8 +1579,8 @@ public class Water { loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); gl.glNewList(displayListID, GL.GL_COMPILE); - gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0); - gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 1, const1); + gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0); + gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 1, const1, 0); gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB); gl.glEndList(); @@ -1619,7 +1632,7 @@ public class Water { float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f }; int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); int fragProg = tmpInt[0]; gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); @@ -1644,7 +1657,7 @@ public class Water { loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); gl.glNewList(displayListID, GL.GL_COMPILE); - gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0); + gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 0, const0, 0); gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB); gl.glEndList(); @@ -1736,7 +1749,7 @@ public class Water { float[] const0 = new float[] { 0.5f, 0.5f, 0.5f, 1.0f }; int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); int fragProg = tmpInt[0]; gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); @@ -1811,7 +1824,7 @@ public class Water { // of a visual difference so they are skipped as well. int[] tmpInt = new int[1]; - gl.glGenProgramsARB(1, tmpInt); + gl.glGenProgramsARB(1, tmpInt, 0); int fragProg = tmpInt[0]; gl.glBindProgramARB(GL.GL_FRAGMENT_PROGRAM_ARB, fragProg); @@ -1848,7 +1861,7 @@ public class Water { String programBuffer) { gl.glProgramStringARB(target, GL.GL_PROGRAM_FORMAT_ASCII_ARB, programBuffer.length(), programBuffer); int[] errPos = new int[1]; - gl.glGetIntegerv(GL.GL_PROGRAM_ERROR_POSITION_ARB, errPos); + gl.glGetIntegerv(GL.GL_PROGRAM_ERROR_POSITION_ARB, errPos, 0); if (errPos[0] >= 0) { String kind = "Program"; if (target == GL.GL_VERTEX_PROGRAM_ARB) { @@ -1875,7 +1888,7 @@ public class Water { int[] isNative = new int[1]; gl.glGetProgramivARB(GL.GL_FRAGMENT_PROGRAM_ARB, GL.GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB, - isNative); + isNative, 0); if (isNative[0] != 1) { System.out.println("WARNING: fragment program is over native resource limits"); Thread.dumpStack(); |