diff options
author | Sven Gothel <[email protected]> | 2010-10-14 21:34:27 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-10-14 21:34:27 +0200 |
commit | 1ff81eb806d6df78994a808217eb2c5f6b4ef8da (patch) | |
tree | 7ae11fd92f63019c6c54862c66eb2656bcc2ef97 /src/demos/vertexArrayRange | |
parent | 0d1ea8ae8eb940b1b29f4f80c232a1d456300362 (diff) |
Fix/Syn with JOGL 774138544e1eec3330309ad682fa05154a07ab8d ; Notably add: Applet's with native NEWT support, ie jogl-newt-applet-runner-gears.html
Diffstat (limited to 'src/demos/vertexArrayRange')
-rw-r--r-- | src/demos/vertexArrayRange/VertexArrayRange.java | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/demos/vertexArrayRange/VertexArrayRange.java b/src/demos/vertexArrayRange/VertexArrayRange.java index b41de6e..aed110d 100644 --- a/src/demos/vertexArrayRange/VertexArrayRange.java +++ b/src/demos/vertexArrayRange/VertexArrayRange.java @@ -52,7 +52,7 @@ import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; -import javax.media.opengl.util.Animator; +import com.jogamp.opengl.util.Animator; import javax.swing.JOptionPane; @@ -89,10 +89,14 @@ import javax.swing.JOptionPane; respectively. </P> */ public class VertexArrayRange extends Demo { - static { - GLProfile.initSingleton(); - } public static void main(String[] args) { + // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example + // <application-desc main-class="demos.j2d.TextCube"/> + // <argument>NotFirstUIActionOnProcess</argument> + // </application-desc> + boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ; + GLProfile.initSingleton(firstUIActionOnProcess); + boolean startSlow = false; if (args.length > 1) { @@ -114,6 +118,14 @@ public class VertexArrayRange extends Demo { } canvas.addGLEventListener(demo); + final VertexArrayRange f_demo = demo; + canvas.addKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + f_demo.dispatchKey(e.getKeyChar()); + } + }); + + final Animator animator = new Animator(canvas); animator.setRunAsFastAsPossible(true); demo.setDemoListener(new DemoListener() { @@ -350,15 +362,9 @@ public class VertexArrayRange extends Demo { gl.glEnableClientState(GL2ES1.GL_NORMAL_ARRAY); computeElements(); - - drawable.addKeyListener(new KeyAdapter() { - public void keyTyped(KeyEvent e) { - dispatchKey(e.getKeyChar()); - } - }); } - private void allocateBuffersAndFences(GL gl) { + private void allocateBuffersAndFences(GL2 gl) { buffers = new VarBuffer[numBuffers]; int[] fences = new int[1]; for (int i = 0; i < numBuffers; i++) { @@ -493,11 +499,11 @@ public class VertexArrayRange extends Demo { if (toggleVAR) { if (getFlag('v')) { - gl.glEnableClientState(GL2ES1.GL_VERTEX_ARRAY_RANGE_NV); + gl.glEnableClientState(GL2.GL_VERTEX_ARRAY_RANGE_NV); gl.glVertexArrayRangeNV(bufferSize, bigArrayVar); bigArray = bigArrayVar; } else { - gl.glDisableClientState(GL2ES1.GL_VERTEX_ARRAY_RANGE_NV); + gl.glDisableClientState(GL2.GL_VERTEX_ARRAY_RANGE_NV); bigArray = bigArraySystem; } toggleVAR = false; @@ -621,13 +627,13 @@ public class VertexArrayRange extends Demo { for (int i = 0; i < elements.length; i++) { ++numDrawElementsCalls; - gl.glDrawElements(primitive, elements[i].capacity(), GL.GL_UNSIGNED_INT, elements[i]); + gl.glDrawElements(primitive, elements[i].capacity(), GL2.GL_UNSIGNED_INT, elements[i]); if(getFlag('f')) { gl.glFlush(); } } - gl.glSetFenceNV(buffers[cur].fence, GL.GL_ALL_COMPLETED_NV); + gl.glSetFenceNV(buffers[cur].fence, GL2.GL_ALL_COMPLETED_NV); } gl.glPopMatrix(); @@ -661,7 +667,7 @@ public class VertexArrayRange extends Demo { // Unused routines public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - private void allocateBigArray(GL gl, boolean tryAgain) { + private void allocateBigArray(GL2 gl, boolean tryAgain) { float priority = .5f; bigArraySystem = setupBuffer(ByteBuffer.allocateDirect(bufferSize)); |