diff options
author | Michael Bien <[email protected]> | 2010-03-29 15:38:31 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-03-29 15:38:31 +0200 |
commit | 0b708395a18eb6a2ae5372ff414bc75830ce19b6 (patch) | |
tree | f2cc555a6085f15972c319311dd01aa734b42b86 /src/demos/es1/cube | |
parent | 19528b880625ee830ab03cb2724311a874240fe8 (diff) |
modifications due to refactorings in gluegen and jogl.
Diffstat (limited to 'src/demos/es1/cube')
-rw-r--r-- | src/demos/es1/cube/Cube.java | 20 | ||||
-rw-r--r-- | src/demos/es1/cube/CubeImmModeSink.java | 9 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index 198bba8..d2a3277 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -31,12 +31,12 @@ */ package demos.es1.cube; +import com.jogamp.gluegen.runtime.Buffers; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; import javax.media.nativewindow.*; -import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.glsl.fixedfunc.*; import com.jogamp.newt.*; @@ -55,24 +55,24 @@ public class Cube implements GLEventListener { this.innerCube = innerCube; // Initialize data Buffers - this.cubeVertices = BufferUtil.newShortBuffer(s_cubeVertices.length); + this.cubeVertices = Buffers.newDirectShortBuffer(s_cubeVertices.length); cubeVertices.put(s_cubeVertices); cubeVertices.flip(); - this.cubeColors = BufferUtil.newFloatBuffer(s_cubeColors.length); + this.cubeColors = Buffers.newDirectFloatBuffer(s_cubeColors.length); cubeColors.put(s_cubeColors); cubeColors.flip(); - this.cubeNormals = BufferUtil.newByteBuffer(s_cubeNormals.length); + this.cubeNormals = Buffers.newDirectByteBuffer(s_cubeNormals.length); cubeNormals.put(s_cubeNormals); cubeNormals.flip(); - this.cubeIndices = BufferUtil.newByteBuffer(s_cubeIndices.length); + this.cubeIndices = Buffers.newDirectByteBuffer(s_cubeIndices.length); cubeIndices.put(s_cubeIndices); cubeIndices.flip(); if (useTexCoords) { - this.cubeTexCoords = BufferUtil.newShortBuffer(s_cubeTexCoords.length); + this.cubeTexCoords = Buffers.newDirectShortBuffer(s_cubeTexCoords.length); cubeTexCoords.put(s_cubeTexCoords); cubeTexCoords.flip(); } @@ -153,23 +153,23 @@ public class Cube implements GLEventListener { gl.glEnableClientState(gl.GL_VERTEX_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[0]); - gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeVertices.limit() * BufferUtil.SIZEOF_SHORT, cubeVertices, GL.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeVertices.limit() * Buffers.SIZEOF_SHORT, cubeVertices, GL.GL_STATIC_DRAW); gl.glVertexPointer(3, gl.GL_SHORT, 0, 0); gl.glEnableClientState(gl.GL_NORMAL_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[1]); - gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeNormals.limit() * BufferUtil.SIZEOF_BYTE, cubeNormals, GL.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeNormals.limit() * Buffers.SIZEOF_BYTE, cubeNormals, GL.GL_STATIC_DRAW); gl.glNormalPointer(gl.GL_BYTE, 0, 0); gl.glEnableClientState(gl.GL_COLOR_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[2]); - gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeColors.limit() * BufferUtil.SIZEOF_FLOAT, cubeColors, GL.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeColors.limit() * Buffers.SIZEOF_FLOAT, cubeColors, GL.GL_STATIC_DRAW); gl.glColorPointer(4, gl.GL_FLOAT, 0, 0); if (cubeTexCoords != null) { gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[3]); - gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeTexCoords.limit() * BufferUtil.SIZEOF_SHORT, cubeTexCoords, GL.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeTexCoords.limit() * Buffers.SIZEOF_SHORT, cubeTexCoords, GL.GL_STATIC_DRAW); gl.glTexCoordPointer(2, gl.GL_SHORT, 0, 0); /* issues an GL_INVALID_ENUM gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_INCR); diff --git a/src/demos/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java index fccbb5a..e91a595 100644 --- a/src/demos/es1/cube/CubeImmModeSink.java +++ b/src/demos/es1/cube/CubeImmModeSink.java @@ -31,6 +31,7 @@ */ package demos.es1.cube; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.*; import javax.media.opengl.glu.*; import javax.media.nativewindow.*; @@ -54,7 +55,7 @@ public class CubeImmModeSink implements GLEventListener { ImmModeSink vboCubeF = null; public void drawCube(GL2ES1 gl, float extent) { if(cubeIndices==null) { - cubeIndices = BufferUtil.newByteBuffer(s_cubeIndices); + cubeIndices = Buffers.newDirectByteBuffer(s_cubeIndices); } if(vboCubeF==null) { @@ -66,9 +67,9 @@ public class CubeImmModeSink implements GLEventListener { vbo.glBegin(GL.GL_TRIANGLES); - vbo.glVertexv(BufferUtil.newShortBuffer(s_cubeVertices)); - vbo.glColorv(BufferUtil.newFloatBuffer(s_cubeColors)); - vbo.glNormalv(BufferUtil.newByteBuffer(s_cubeNormals)); + vbo.glVertexv(Buffers.newDirectShortBuffer(s_cubeVertices)); + vbo.glColorv(Buffers.newDirectFloatBuffer(s_cubeColors)); + vbo.glNormalv(Buffers.newDirectByteBuffer(s_cubeNormals)); if(VBO_CACHE) { vbo.glEnd(gl, false); |