From affb27f968fb3cb7902146ad7b521b7b24d18fe5 Mon Sep 17 00:00:00 2001
From: Kenneth Russel <kbrussel@alum.mit.edu>
Date: Fri, 8 Jul 2005 16:03:14 +0000
Subject: Fixed Windows port after changes to GlueGen to include array offsets.
 Ported all demos to new API. Temporarily added back in GLU entry points
 taking primitive arrays as the underlying APIs (in particular, glTexImage2D)
 do not yet support non-direct Buffers. Changed C code generation to only add
 in array offset if array is non-null. Fixed bug in GLU tesselator demo's
 vertex callback.

git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@99 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
---
 .../vertexBufferObject/VertexBufferObject.java     | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'src/demos/vertexBufferObject/VertexBufferObject.java')

diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java
index 02bae92..060fd62 100644
--- a/src/demos/vertexBufferObject/VertexBufferObject.java
+++ b/src/demos/vertexBufferObject/VertexBufferObject.java
@@ -301,12 +301,12 @@ public class VertexBufferObject {
       gl.glEnable(GL.GL_LIGHT0);
       gl.glEnable(GL.GL_LIGHTING);
       gl.glEnable(GL.GL_NORMALIZE);
-      gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[]  {.1f, .1f,    0, 1});
-      gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[]  {.6f, .6f,  .1f, 1});
-      gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] { 1,    1, .75f, 1});
+      gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[]  {.1f, .1f,    0, 1}, 0);
+      gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[]  {.6f, .6f,  .1f, 1}, 0);
+      gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] { 1,    1, .75f, 1}, 0);
       gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, 128.f);
 
-      gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0});
+      gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0}, 0);
       gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
 
       // NOTE: it looks like GLUT (or something else) sets up the
@@ -501,10 +501,10 @@ public class VertexBufferObject {
       if (toggleLightingModel) {
         if(getFlag('i')) {
           // infinite light
-          gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0 });
+          gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0 }, 0);
           gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
         } else {
-          gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, -.5f,1 });
+          gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, -.5f,1 }, 0);
           gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
         }
         toggleLightingModel = false;
@@ -525,7 +525,7 @@ public class VertexBufferObject {
           0, 0, 1, 0,
           0, 0, -1, 1
       };
-      gl.glLoadMatrixf(modelViewMatrix);
+      gl.glLoadMatrixf(modelViewMatrix, 0);
 
       // FIXME: add mouse interaction
       // camera.apply_inverse_transform();
@@ -646,7 +646,7 @@ public class VertexBufferObject {
         } else {
           for (int i = 0; i < elements.length; i++) {
             ++numDrawElementsCalls;
-            gl.glDrawElements(primitive, elements[i].length, GL.GL_UNSIGNED_INT, elements[i]);
+            gl.glDrawElements(primitive, elements[i].length, GL.GL_UNSIGNED_INT, elements[i], 0);
             if(getFlag('f')) {
               gl.glFlush();
             }
@@ -687,7 +687,7 @@ public class VertexBufferObject {
     bigArraySystem = setupBuffer(ByteBuffer.allocateDirect(bufferSize));
 
     int[] tmp = new int[1];
-    gl.glGenBuffersARB(1, tmp);
+    gl.glGenBuffersARB(1, tmp, 0);
     bigBufferObject = tmp[0];
     gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, bigBufferObject);
     // Initialize data store of buffer object
@@ -741,12 +741,12 @@ public class VertexBufferObject {
       }
     }
     int[] tmp = new int[1];
-    gl.glGenBuffersARB(1, tmp);
+    gl.glGenBuffersARB(1, tmp, 0);
     elementBufferObject = tmp[0];
     gl.glBindBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, elementBufferObject);
     gl.glBufferDataARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB,
                        linearElements.length * BufferUtils.SIZEOF_INT,
-                       linearElements,
+                       linearElements, 0,
                        GL.GL_STATIC_DRAW_ARB);
     gl.glBindBufferARB(GL.GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
   }
-- 
cgit v1.2.3