diff options
Diffstat (limited to 'src')
56 files changed, 362 insertions, 316 deletions
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java index f33168f..b550324 100644 --- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java +++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java @@ -333,9 +333,9 @@ public class runtime_ogl_vertex_fragment implements GLEventListener if (P == null) { int u, v; - P = BufferUtil.newFloatBuffer(3*nVerts); - N = BufferUtil.newFloatBuffer(3*nVerts); - uv = BufferUtil.newFloatBuffer(2*nVerts); + P = GLBuffers.newDirectFloatBuffer(3*nVerts); + N = GLBuffers.newDirectFloatBuffer(3*nVerts); + uv = GLBuffers.newDirectFloatBuffer(2*nVerts); // Fill in the position, normal, and texture coordinate arrays. // Just loop over all of the vertices, compute their parametreic @@ -358,7 +358,7 @@ public class runtime_ogl_vertex_fragment implements GLEventListener } // Now fill in the vertex index arrays - indices = BufferUtil.newIntBuffer(3*nTris); + indices = GLBuffers.newDirectIntBuffer(3*nTris); int ip = 0; for (v = 0; v < nv-1; ++v) { for (u = 0; u < nu-1; ++u) { diff --git a/src/demos/cubefbo/CubeObject.java b/src/demos/cubefbo/CubeObject.java index bf3f8bc..dd3da91 100755 --- a/src/demos/cubefbo/CubeObject.java +++ b/src/demos/cubefbo/CubeObject.java @@ -33,34 +33,35 @@ package demos.cubefbo; +import com.jogamp.gluegen.runtime.Buffers; import java.nio.ByteBuffer; import java.nio.ShortBuffer; import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; -import com.jogamp.opengl.util.BufferUtil; class CubeObject { - public CubeObject (boolean useTexCoords) { + + CubeObject (boolean useTexCoords) { // Initialize data Buffers - this.cubeVertices = BufferUtil.newShortBuffer(s_cubeVertices.length); + this.cubeVertices = Buffers.newDirectShortBuffer(s_cubeVertices.length); cubeVertices.put(s_cubeVertices); cubeVertices.rewind(); - this.cubeColors = BufferUtil.newByteBuffer(s_cubeColors.length); + this.cubeColors = Buffers.newDirectByteBuffer(s_cubeColors.length); cubeColors.put(s_cubeColors); cubeColors.rewind(); - this.cubeNormals = BufferUtil.newByteBuffer(s_cubeNormals.length); + this.cubeNormals = Buffers.newDirectByteBuffer(s_cubeNormals.length); cubeNormals.put(s_cubeNormals); cubeNormals.rewind(); - this.cubeIndices = BufferUtil.newByteBuffer(s_cubeIndices.length); + this.cubeIndices = Buffers.newDirectByteBuffer(s_cubeIndices.length); cubeIndices.put(s_cubeIndices); cubeIndices.rewind(); if (useTexCoords) { - this.cubeTexCoords = BufferUtil.newShortBuffer(s_cubeTexCoords.length); + this.cubeTexCoords = Buffers.newDirectShortBuffer(s_cubeTexCoords.length); cubeTexCoords.put(s_cubeTexCoords); cubeTexCoords.rewind(); } diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index d391442..4741258 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -1,5 +1,6 @@ package demos.es1; +import com.jogamp.gluegen.runtime.Buffers; import java.nio.*; import java.util.*; import javax.media.opengl.*; @@ -241,8 +242,8 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo System.err.println(Thread.currentThread()+" GLU: " + glu); // Allocate vertex arrays - colors = BufferUtil.newFloatBuffer(16); - vertices = BufferUtil.newFloatBuffer(12); + colors = Buffers.newDirectFloatBuffer(16); + vertices = Buffers.newDirectFloatBuffer(12); // Fill them up colors.put( 0, 1); colors.put( 1, 0); colors.put( 2, 0); colors.put( 3, 1); colors.put( 4, 0); colors.put( 5, 0); colors.put( 6, 1); colors.put( 7, 1); diff --git a/src/demos/es1/angeles/AngelesES1.java b/src/demos/es1/angeles/AngelesES1.java index edba727..6c868c4 100755 --- a/src/demos/es1/angeles/AngelesES1.java +++ b/src/demos/es1/angeles/AngelesES1.java @@ -24,6 +24,7 @@ package demos.es1.angeles; +import com.jogamp.gluegen.runtime.Buffers; import javax.media.opengl.*; import javax.media.opengl.glu.*; import com.jogamp.opengl.util.*; @@ -37,7 +38,7 @@ public class AngelesES1 implements GLEventListener { public AngelesES1(boolean enableBlending) { blendingEnabled = enableBlending; - quadVertices = BufferUtil.newIntBuffer(12); + quadVertices = Buffers.newDirectIntBuffer(12); quadVertices.put(new int[]{ -0x10000, -0x10000, 0x10000, -0x10000, @@ -48,13 +49,13 @@ public class AngelesES1 implements GLEventListener { }); quadVertices.flip(); - light0Position=BufferUtil.newIntBuffer(4); - light0Diffuse=BufferUtil.newIntBuffer(4); - light1Position=BufferUtil.newIntBuffer(4); - light1Diffuse=BufferUtil.newIntBuffer(4); - light2Position=BufferUtil.newIntBuffer(4); - light2Diffuse=BufferUtil.newIntBuffer(4); - materialSpecular=BufferUtil.newIntBuffer(4); + light0Position=Buffers.newDirectIntBuffer(4); + light0Diffuse=Buffers.newDirectIntBuffer(4); + light1Position=Buffers.newDirectIntBuffer(4); + light1Diffuse=Buffers.newDirectIntBuffer(4); + light2Position=Buffers.newDirectIntBuffer(4); + light2Diffuse=Buffers.newDirectIntBuffer(4); + materialSpecular=Buffers.newDirectIntBuffer(4); light0Position.put(new int[] { -0x40000, 0x10000, 0x10000, 0 }); light0Diffuse.put(new int[] { 0x10000, 0x6666, 0, 0x10000 }); @@ -245,11 +246,11 @@ public class GLObject { boolean useNormalArray) { this.count = vertices; this.vertexComponents = vertexComponents; - this.vertexArray = BufferUtil.newIntBuffer( vertices * vertexComponents ); - this.colorArray = BufferUtil.newByteBuffer (vertices * 4 ); + this.vertexArray = Buffers.newDirectIntBuffer( vertices * vertexComponents ); + this.colorArray = Buffers.newDirectByteBuffer (vertices * 4 ); if (useNormalArray) { - this.normalArray = BufferUtil.newIntBuffer (vertices * 3 ); + this.normalArray = Buffers.newDirectIntBuffer (vertices * 3 ); } else { this.normalArray = null; } @@ -262,18 +263,18 @@ public class GLObject { gl.glGenBuffers(3, vbo, 0); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo[0]); - gl.glBufferData(GL.GL_ARRAY_BUFFER, vertexArray.capacity() * BufferUtil.SIZEOF_INT, vertexArray, GL.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, vertexArray.capacity() * Buffers.SIZEOF_INT, vertexArray, GL.GL_STATIC_DRAW); gl.glVertexPointer(vertexComponents, gl.GL_FIXED, 0, 0); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo[1]); - gl.glBufferData(GL.GL_ARRAY_BUFFER, colorArray.capacity() * BufferUtil.SIZEOF_BYTE, colorArray, GL.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, colorArray.capacity() * Buffers.SIZEOF_BYTE, colorArray, GL.GL_STATIC_DRAW); gl.glColorPointer(4, gl.GL_UNSIGNED_BYTE, 0, 0); if (null!=normalArray) { gl.glEnableClientState(gl.GL_NORMAL_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo[2]); - gl.glBufferData(GL.GL_ARRAY_BUFFER, normalArray.capacity() * BufferUtil.SIZEOF_INT, normalArray, GL.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, normalArray.capacity() * Buffers.SIZEOF_INT, normalArray, GL.GL_STATIC_DRAW); gl.glNormalPointer(gl.GL_FIXED, 0, 0); } else { gl.glDisableClientState(gl.GL_NORMAL_ARRAY); diff --git a/src/demos/es1/angeles/AngelesGL.java b/src/demos/es1/angeles/AngelesGL.java index afcc356..bc367d7 100755 --- a/src/demos/es1/angeles/AngelesGL.java +++ b/src/demos/es1/angeles/AngelesGL.java @@ -38,7 +38,7 @@ public class AngelesGL implements GLEventListener { public AngelesGL(boolean enableBlending) { blendingEnabled = enableBlending; - quadVertices = BufferUtil.newFloatBuffer(12); + quadVertices = GLBuffers.newDirectFloatBuffer(12); quadVertices.put(new float[]{ -1.0f, -1.0f, 1.0f, -1.0f, @@ -49,13 +49,13 @@ public class AngelesGL implements GLEventListener { }); quadVertices.flip(); - light0Position=BufferUtil.newFloatBuffer(4); - light0Diffuse=BufferUtil.newFloatBuffer(4); - light1Position=BufferUtil.newFloatBuffer(4); - light1Diffuse=BufferUtil.newFloatBuffer(4); - light2Position=BufferUtil.newFloatBuffer(4); - light2Diffuse=BufferUtil.newFloatBuffer(4); - materialSpecular=BufferUtil.newFloatBuffer(4); + light0Position=GLBuffers.newDirectFloatBuffer(4); + light0Diffuse=GLBuffers.newDirectFloatBuffer(4); + light1Position=GLBuffers.newDirectFloatBuffer(4); + light1Diffuse=GLBuffers.newDirectFloatBuffer(4); + light2Position=GLBuffers.newDirectFloatBuffer(4); + light2Diffuse=GLBuffers.newDirectFloatBuffer(4); + materialSpecular=GLBuffers.newDirectFloatBuffer(4); light0Position.put(new float[] { FixedPoint.toFloat(-0x40000), 1.0f, 1.0f, 0.0f }); light0Diffuse.put(new float[] { 1.0f, FixedPoint.toFloat(0x6666), 0.0f, 1.0f }); @@ -271,24 +271,24 @@ public class GLSpatial { vComps= vertexComponents; nComps = useNormalArray ? 3 : 0; - int bSize = BufferUtil.sizeOfGLType(GL.GL_FLOAT) * count * ( vComps + cComps + nComps) ; - pBuffer = BufferUtil.newByteBuffer(bSize); + int bSize = GLBuffers.sizeOfGLType(GL.GL_FLOAT) * count * ( vComps + cComps + nComps) ; + pBuffer = GLBuffers.newDirectByteBuffer(bSize); int pos = 0; - int size= BufferUtil.sizeOfGLType(GL.GL_FLOAT) * count * vComps ; - vertexArray = (FloatBuffer) BufferUtil.sliceGLBuffer(pBuffer, pos, size, GL.GL_FLOAT); + int size= GLBuffers.sizeOfGLType(GL.GL_FLOAT) * count * vComps ; + vertexArray = (FloatBuffer) GLBuffers.sliceGLBuffer(pBuffer, pos, size, GL.GL_FLOAT); int vOffset = 0; pos+=size; - size=BufferUtil.sizeOfGLType(GL.GL_FLOAT) * count * cComps ; - colorArray = (FloatBuffer) BufferUtil.sliceGLBuffer(pBuffer, pos, size, GL.GL_FLOAT); + size=GLBuffers.sizeOfGLType(GL.GL_FLOAT) * count * cComps ; + colorArray = (FloatBuffer) GLBuffers.sliceGLBuffer(pBuffer, pos, size, GL.GL_FLOAT); int cOffset=pos; pos+=size; int nOffset=0; if(useNormalArray) { - size=BufferUtil.sizeOfGLType(GL.GL_FLOAT) * count * nComps ; - normalArray = (FloatBuffer) BufferUtil.sliceGLBuffer(pBuffer, pos, size, GL.GL_FLOAT); + size=GLBuffers.sizeOfGLType(GL.GL_FLOAT) * count * nComps ; + normalArray = (FloatBuffer) GLBuffers.sliceGLBuffer(pBuffer, pos, size, GL.GL_FLOAT); nOffset=pos; pos+=size; } diff --git a/src/demos/es1/angeles/AngelesGLil.java b/src/demos/es1/angeles/AngelesGLil.java index bbfb86a..92be109 100755 --- a/src/demos/es1/angeles/AngelesGLil.java +++ b/src/demos/es1/angeles/AngelesGLil.java @@ -34,7 +34,7 @@ public class AngelesGLil implements GLEventListener { public AngelesGLil(boolean enableBlending) { blendingEnabled = enableBlending; - quadVertices = BufferUtil.newFloatBuffer(12); + quadVertices = GLBuffers.newDirectFloatBuffer(12); quadVertices.put(new float[]{ -1.0f, -1.0f, 1.0f, -1.0f, @@ -45,13 +45,13 @@ public class AngelesGLil implements GLEventListener { }); quadVertices.flip(); - light0Position=BufferUtil.newFloatBuffer(4); - light0Diffuse=BufferUtil.newFloatBuffer(4); - light1Position=BufferUtil.newFloatBuffer(4); - light1Diffuse=BufferUtil.newFloatBuffer(4); - light2Position=BufferUtil.newFloatBuffer(4); - light2Diffuse=BufferUtil.newFloatBuffer(4); - materialSpecular=BufferUtil.newFloatBuffer(4); + light0Position=GLBuffers.newDirectFloatBuffer(4); + light0Diffuse=GLBuffers.newDirectFloatBuffer(4); + light1Position=GLBuffers.newDirectFloatBuffer(4); + light1Diffuse=GLBuffers.newDirectFloatBuffer(4); + light2Position=GLBuffers.newDirectFloatBuffer(4); + light2Diffuse=GLBuffers.newDirectFloatBuffer(4); + materialSpecular=GLBuffers.newDirectFloatBuffer(4); light0Position.put(new float[] { FixedPoint.toFloat(-0x40000), 1.0f, 1.0f, 0.0f }); light0Diffuse.put(new float[] { 1.0f, FixedPoint.toFloat(0x6666), 0.0f, 1.0f }); @@ -277,15 +277,15 @@ public class GLSpatial { vComps= vertexComponents; nComps = useNormalArray ? 3 : 0; - int bStride = BufferUtil.sizeOfGLType(GL.GL_FLOAT) * ( vComps + cComps + nComps ); + int bStride = GLBuffers.sizeOfGLType(GL.GL_FLOAT) * ( vComps + cComps + nComps ); int bSize = count * bStride; - pBuffer = BufferUtil.newByteBuffer(bSize); + pBuffer = GLBuffers.newDirectByteBuffer(bSize); interlArray = pBuffer.asFloatBuffer(); int vOffset = 0; - int cOffset = BufferUtil.sizeOfGLType(GL.GL_FLOAT) * (vComps); - int nOffset = BufferUtil.sizeOfGLType(GL.GL_FLOAT) * (vComps + cComps); + int cOffset = GLBuffers.sizeOfGLType(GL.GL_FLOAT) * (vComps); + int nOffset = GLBuffers.sizeOfGLType(GL.GL_FLOAT) * (vComps + cComps); int[] tmp = new int[1]; gl.glGenBuffers(1, tmp, 0); 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); diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java index 49c8a31..aa4b8dd 100644 --- a/src/demos/es2/openmax/Cube.java +++ b/src/demos/es2/openmax/Cube.java @@ -31,12 +31,12 @@ */ package demos.es2.openmax; +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.*; @@ -53,19 +53,19 @@ 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(); @@ -86,7 +86,7 @@ public class Cube implements GLEventListener { } } - this.cubeTexCoords = BufferUtil.newFloatBuffer(s_cubeTexCoords.length); + this.cubeTexCoords = Buffers.newDirectFloatBuffer(s_cubeTexCoords.length); cubeTexCoords.put(s_cubeTexCoords); cubeTexCoords.flip(); } @@ -151,26 +151,26 @@ 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); if (cubeColors != null) { 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); gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_INCR); } else { diff --git a/src/demos/es2/perftst/PerfUniLoad.java b/src/demos/es2/perftst/PerfUniLoad.java index 7cf32a2..170bf1a 100755 --- a/src/demos/es2/perftst/PerfUniLoad.java +++ b/src/demos/es2/perftst/PerfUniLoad.java @@ -1,5 +1,6 @@ package demos.es2.perftst; +import com.jogamp.gluegen.runtime.Buffers; import java.nio.*; import javax.media.opengl.*; import com.jogamp.opengl.util.*; @@ -65,7 +66,7 @@ public class PerfUniLoad extends PerfModule { float x=0f, y=0f, z=0f, w=0f; for(int i=0; i<numObjs; i++) { - FloatBuffer fb = BufferUtil.newFloatBuffer(4*numArrayElem); + FloatBuffer fb = Buffers.newDirectFloatBuffer(4*numArrayElem); for(int j=0; j<numArrayElem; j++) { // Fill them up @@ -121,7 +122,7 @@ public class PerfUniLoad extends PerfModule { } int uniElements = numObjs * numArrayElem ; - int uniBytes = uniElements * BufferUtil.SIZEOF_FLOAT; + int uniBytes = uniElements * Buffers.SIZEOF_FLOAT; dt = 0; for(int i=1; i<loops; i++) { diff --git a/src/demos/misc/Picking.java b/src/demos/misc/Picking.java index 27a0fe2..0e1596a 100755 --- a/src/demos/misc/Picking.java +++ b/src/demos/misc/Picking.java @@ -10,6 +10,7 @@ package demos.misc; // Notes: * Based on example 13-3 (p 542) in the "OpenGL Programming Guide" // * This version should handle overlapping objects correctly. //--------------------------------------------------------------------------------- +import com.jogamp.gluegen.runtime.Buffers; import java.awt.*; import java.awt.event.*; import java.awt.Canvas.*; @@ -18,7 +19,6 @@ import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.*; import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.BufferUtil; public class Picking { @@ -96,7 +96,7 @@ public class Picking int buffsize = 512; double x = (double) mouse_x, y = (double) mouse_y; int[] viewPort = new int[4]; - IntBuffer selectBuffer = BufferUtil.newIntBuffer(buffsize); + IntBuffer selectBuffer = Buffers.newDirectIntBuffer(buffsize); int hits = 0; gl.glGetIntegerv(GL2.GL_VIEWPORT, viewPort, 0); gl.glSelectBuffer(buffsize, selectBuffer); diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index fdf4224..f718604 100644 --- a/src/demos/proceduralTexturePhysics/Water.java +++ b/src/demos/proceduralTexturePhysics/Water.java @@ -41,13 +41,11 @@ import demos.util.Cubemap; import gleem.linalg.Mat4f; import gleem.linalg.Rotf; import java.io.IOException; -import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.media.opengl.GLProfile; import javax.media.opengl.GL; -import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; @@ -56,7 +54,6 @@ import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; import javax.media.opengl.GLPbuffer; import javax.media.opengl.glu.GLU; -import com.jogamp.opengl.util.BufferUtil; diff --git a/src/demos/readbuffer/ReadBuffer2Screen.java b/src/demos/readbuffer/ReadBuffer2Screen.java index 39a4a27..13e6508 100755 --- a/src/demos/readbuffer/ReadBuffer2Screen.java +++ b/src/demos/readbuffer/ReadBuffer2Screen.java @@ -38,15 +38,11 @@ import javax.media.opengl.*; import javax.media.opengl.fixedfunc.*; import com.jogamp.opengl.util.*; -import com.jogamp.opengl.util.glsl.fixedfunc.*; import javax.media.opengl.fixedfunc.GLPointerFunc; -import com.jogamp.opengl.util.texture.Texture; -import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureCoords; import com.jogamp.opengl.util.GLArrayDataClient; import com.jogamp.opengl.util.GLArrayDataServer; -import com.jogamp.opengl.util.BufferUtil; public class ReadBuffer2Screen extends ReadBufferBase { PMVMatrix pmvMatrix; diff --git a/src/demos/readbuffer/ReadBufferBase.java b/src/demos/readbuffer/ReadBufferBase.java index 53f2ba9..bb2d228 100755 --- a/src/demos/readbuffer/ReadBufferBase.java +++ b/src/demos/readbuffer/ReadBufferBase.java @@ -33,13 +33,8 @@ package demos.readbuffer; -import java.nio.*; import javax.media.opengl.*; -import com.jogamp.opengl.util.texture.Texture; -import com.jogamp.opengl.util.texture.TextureData; -import com.jogamp.opengl.util.BufferUtil; - public class ReadBufferBase implements GLEventListener { public boolean glDebug = false ; diff --git a/src/demos/readbuffer/ReadBufferUtil.java b/src/demos/readbuffer/ReadBufferUtil.java index 5cba034..85680c7 100755 --- a/src/demos/readbuffer/ReadBufferUtil.java +++ b/src/demos/readbuffer/ReadBufferUtil.java @@ -33,12 +33,12 @@ package demos.readbuffer; +import com.jogamp.opengl.util.GLBuffers; import java.nio.*; import javax.media.opengl.*; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureData; -import com.jogamp.opengl.util.BufferUtil; public class ReadBufferUtil { protected int readPixelSizeLast = 0; @@ -60,7 +60,7 @@ public class ReadBufferUtil { int readPixelSize = drawable.getWidth() * drawable.getHeight() * 3 ; // RGB boolean newData = false; if(readPixelSize>readPixelSizeLast) { - readPixelBuffer = BufferUtil.newGLBuffer(gl.GL_UNSIGNED_BYTE, readPixelSize); + readPixelBuffer = GLBuffers.newDirectGLBuffer(GL.GL_UNSIGNED_BYTE, readPixelSize); readPixelSizeLast = readPixelSize ; try { readTextureData = new TextureData( diff --git a/src/demos/readbuffer/Surface2File.java b/src/demos/readbuffer/Surface2File.java index ec41039..74fa637 100755 --- a/src/demos/readbuffer/Surface2File.java +++ b/src/demos/readbuffer/Surface2File.java @@ -33,12 +33,9 @@ package demos.readbuffer; -import java.nio.*; import javax.media.opengl.*; -import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; -import com.jogamp.opengl.util.BufferUtil; import java.io.File; import java.io.IOException; diff --git a/src/demos/util/ObjReader.java b/src/demos/util/ObjReader.java index b78baf0..718e96e 100644 --- a/src/demos/util/ObjReader.java +++ b/src/demos/util/ObjReader.java @@ -39,6 +39,7 @@ package demos.util; +import com.jogamp.gluegen.runtime.Buffers; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -52,7 +53,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; -import com.jogamp.opengl.util.BufferUtil; @@ -321,10 +321,10 @@ public class ObjReader { newVertices.trim(); newVertexNormals.trim(); newIndices.trim(); - vertices = BufferUtil.newFloatBuffer(newVertices.size()); + vertices = Buffers.newDirectFloatBuffer(newVertices.size()); vertices.put(newVertices.getData()); vertices.rewind(); - normals = BufferUtil.newFloatBuffer(newVertexNormals.size()); + normals = Buffers.newDirectFloatBuffer(newVertexNormals.size()); normals.put(newVertexNormals.getData()); normals.rewind(); faceIndices = newIndices; diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java index 9c8bb26..5252867 100644 --- a/src/demos/vertexBufferObject/VertexBufferObject.java +++ b/src/demos/vertexBufferObject/VertexBufferObject.java @@ -33,6 +33,7 @@ package demos.vertexBufferObject; +import com.jogamp.gluegen.runtime.Buffers; import demos.common.Demo; import demos.common.DemoListener; import java.awt.BorderLayout; @@ -48,7 +49,6 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import javax.media.opengl.GL; import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; @@ -57,7 +57,6 @@ import javax.media.opengl.awt.AWTGLAutoDrawable; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.BufferUtil; import javax.swing.JOptionPane; @@ -374,8 +373,8 @@ public class VertexBufferObject extends Demo { buffers[i].vertices = sliceBuffer(bigArray, startIndex, sliceSize); buffers[i].normals = sliceBuffer(buffers[i].vertices, 3, buffers[i].vertices.limit() - 3); - buffers[i].vertexOffset = startIndex * BufferUtil.SIZEOF_FLOAT; - buffers[i].normalOffset = (startIndex + 3) * BufferUtil.SIZEOF_FLOAT; + buffers[i].vertexOffset = startIndex * Buffers.SIZEOF_FLOAT; + buffers[i].normalOffset = (startIndex + 3) * Buffers.SIZEOF_FLOAT; } } @@ -653,7 +652,7 @@ public class VertexBufferObject extends Demo { for (int i = 0; i < len; i++) { ++numDrawElementsCalls; gl.glDrawElements(primitive, 2 * STRIP_SIZE, GL2.GL_UNSIGNED_INT, - i * 2 * STRIP_SIZE * BufferUtil.SIZEOF_INT); + i * 2 * STRIP_SIZE * Buffers.SIZEOF_INT); if(getFlag('f')) { gl.glFlush(); } @@ -760,7 +759,7 @@ public class VertexBufferObject extends Demo { elementBufferObject = tmp[0]; gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, elementBufferObject); gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, - linearElements.remaining() * BufferUtil.SIZEOF_INT, + linearElements.remaining() * Buffers.SIZEOF_INT, linearElements, GL.GL_STATIC_DRAW); gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0); diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java index 54c0d5e..65b914c 100644 --- a/src/demos/vertexProgRefract/VertexProgRefract.java +++ b/src/demos/vertexProgRefract/VertexProgRefract.java @@ -58,7 +58,6 @@ import javax.media.opengl.*; import javax.media.opengl.awt.*; import javax.media.opengl.glu.GLU; import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.BufferUtil; import javax.swing.JOptionPane; diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java index 6f917ed..e13656f 100644 --- a/src/demos/vertexProgWarp/VertexProgWarp.java +++ b/src/demos/vertexProgWarp/VertexProgWarp.java @@ -60,7 +60,7 @@ import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.GLUquadric; import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.BufferUtil; +import com.jogamp.opengl.util.GLBuffers; import javax.swing.JOptionPane; diff --git a/src/jbullet/src/javabullet/demos/opengl/GLSRT.java b/src/jbullet/src/javabullet/demos/opengl/GLSRT.java index cdd4aef..a147202 100644 --- a/src/jbullet/src/javabullet/demos/opengl/GLSRT.java +++ b/src/jbullet/src/javabullet/demos/opengl/GLSRT.java @@ -141,7 +141,7 @@ public class GLSRT { 16, 19, 17, 18, 16, 17, /* right */ 23, 20, 21, 20, 22, 21 /* left */ }; - private ByteBuffer cubeIndices=BufferUtil.newByteBuffer(s_cubeIndices); + private ByteBuffer cubeIndices=GLBuffers.newDirectByteBuffer(s_cubeIndices); //////////////////////////////////////////////////////////////////////////// diff --git a/src/redbook/nbproject/build-impl.xml b/src/redbook/nbproject/build-impl.xml index 71d5842..ecbb2fe 100644 --- a/src/redbook/nbproject/build-impl.xml +++ b/src/redbook/nbproject/build-impl.xml @@ -81,6 +81,7 @@ is divided into following sections: </target> <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> <available file="${manifest.file}" property="manifest.available"/> + <available file="${application.splash}" property="splashscreen.available"/> <condition property="main.class.available"> <and> <isset property="main.class"/> @@ -109,23 +110,40 @@ is divided into following sections: <isset property="do.mkdist"/> </and> </condition> - <condition property="manifest.available+mkdist.available"> + <condition property="manifest.available+main.class+mkdist.available+splashscreen.available"> <and> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> + <istrue value="${manifest.available+main.class+mkdist.available}"/> + <istrue value="${splashscreen.available}"/> </and> </condition> - <condition property="manifest.available-mkdist.available"> - <or> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> - </or> + <condition property="do.archive"> + <not> + <istrue value="${jar.archive.disabled}"/> + </not> </condition> - <condition property="manifest.available+main.class-mkdist.available"> - <or> + <condition property="do.archive+manifest.available"> + <and> + <isset property="manifest.available"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+manifest.available+main.class"> + <and> <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </or> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+manifest.available+main.class+mkdist.available"> + <and> + <istrue value="${manifest.available+main.class+mkdist.available}"/> + <istrue value="${do.archive}"/> + </and> + </condition> + <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available"> + <and> + <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/> + <istrue value="${do.archive}"/> + </and> </condition> <condition property="have.tests"> <or> @@ -182,6 +200,8 @@ is divided into following sections: <length length="0" string="${endorsed.classpath}" when="greater"/> </condition> <property name="javac.fork" value="false"/> + <property name="jar.index" value="false"/> + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> </target> <target name="-post-init"> <!-- Empty placeholder for easier customization. --> @@ -208,11 +228,53 @@ is divided into following sections: </sequential> </macrodef> </target> - <target name="-init-macrodef-javac"> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${build.classes.dir}" name="destdir"/> + <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> + <attribute default="${includes}" name="includes"/> + <attribute default="${excludes}" name="excludes"/> + <attribute default="${javac.debug}" name="debug"/> + <attribute default="${empty.dir}" name="sourcepath"/> + <attribute default="${empty.dir}" name="gensrcdir"/> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.dir}/empty" name="empty.dir"/> + <mkdir dir="${empty.dir}"/> + <mkdir dir="@{apgeneratedsrcdir}"/> + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> + <src> + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> + <include name="*"/> + </dirset> + </src> + <classpath> + <path path="@{classpath}"/> + </classpath> + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.compilerargs}"/> + <compilerarg value="-processorpath"/> + <compilerarg path="@{processorpath}"/> + <compilerarg line="${ap.processors.internal}"/> + <compilerarg line="${annotation.processing.processor.options}"/> + <compilerarg value="-s"/> + <compilerarg path="@{apgeneratedsrcdir}"/> + <compilerarg line="${ap.proc.none.internal}"/> + <customize/> + </javac> + </sequential> + </macrodef> + </target> + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${src.dir}" name="srcdir"/> <attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${javac.classpath}" name="classpath"/> + <attribute default="${javac.processorpath}" name="processorpath"/> + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> <attribute default="${includes}" name="includes"/> <attribute default="${excludes}" name="excludes"/> <attribute default="${javac.debug}" name="debug"/> @@ -237,6 +299,8 @@ is divided into following sections: </javac> </sequential> </macrodef> + </target> + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${src.dir}" name="srcdir"/> <attribute default="${build.classes.dir}" name="destdir"/> @@ -384,14 +448,65 @@ is divided into following sections: </sequential> </macrodef> </target> + <target name="-init-macrodef-copylibs"> + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> + <element name="customize" optional="true"/> + <sequential> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <pathconvert property="run.classpath.without.build.classes.dir"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to=""/> + </pathconvert> + <pathconvert pathsep=" " property="jar.classpath"> + <path path="${run.classpath.without.build.classes.dir}"/> + <chainedmapper> + <flattenmapper/> + <globmapper from="*" to="lib/*"/> + </chainedmapper> + </pathconvert> + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> + <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}"/> + <manifest> + <attribute name="Class-Path" value="${jar.classpath}"/> + <customize/> + </manifest> + </copylibs> + </sequential> + </macrodef> + </target> <target name="-init-presetdef-jar"> <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> - <jar compress="${jar.compress}" jarfile="${dist.jar}"> + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> <j2seproject1:fileset dir="${build.classes.dir}"/> </jar> </presetdef> </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/> + <target name="-init-ap-cmdline-properties"> + <property name="annotation.processing.enabled" value="true"/> + <property name="annotation.processing.processors.list" value=""/> + <property name="annotation.processing.processor.options" value=""/> + <property name="annotation.processing.run.all.processors" value="true"/> + <property name="javac.processorpath" value="${javac.classpath}"/> + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> + <condition property="ap.supported.internal" value="true"> + <not> + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> + </not> + </condition> + </target> + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> + <isfalse value="${annotation.processing.run.all.processors}"/> + </condition> + <condition else="" property="ap.proc.none.internal" value="-proc:none"> + <isfalse value="${annotation.processing.enabled}"/> + </condition> + </target> + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> + <property name="ap.cmd.line.internal" value=""/> + </target> + <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> <!-- =================== COMPILATION SECTION @@ -435,12 +550,18 @@ is divided into following sections: </pathconvert> <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> </target> - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile"> + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> <copy todir="${build.classes.dir}"> <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> </copy> </target> + <target if="has.persistence.xml" name="-copy-persistence-xml"> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy todir="${build.classes.dir}/META-INF"> + <fileset dir="${meta.inf.dir}" includes="persistence.xml"/> + </copy> + </target> <target name="-post-compile"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> @@ -473,13 +594,13 @@ is divided into following sections: <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available"> <j2seproject1:jar/> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class"> <j2seproject1:jar manifest="${manifest.file}"/> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> <j2seproject1:jar manifest="${manifest.file}"> <j2seproject1:manifest> <j2seproject1:attribute name="Main-Class" value="${main.class}"/> @@ -494,78 +615,35 @@ is divided into following sections: </pathconvert> <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries"> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen"> + <basename file="${application.splash}" property="splashscreen.basename"/> + <mkdir dir="${build.classes.dir}/META-INF"/> + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> + <j2seproject3:copylibs> + <customize> <attribute name="Main-Class" value="${main.class}"/> - <attribute name="Class-Path" value="${jar.classpath}"/> - </manifest> - </copylibs> + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> + </customize> + </j2seproject3:copylibs> <echo>To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> <echo>java -jar "${dist.jar.resolved}"</echo> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available"> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> - <attribute name="Class-Path" value="${jar.classpath}"/> - </manifest> - </copylibs> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available"> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> - <attribute name="Class-Path" value="${jar.classpath}"/> - </manifest> - </copylibs> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available"> + <j2seproject3:copylibs> + <customize> + <attribute name="Main-Class" value="${main.class}"/> + </customize> + </j2seproject3:copylibs> + <echo>To run this application from the command line without Ant, try:</echo> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <echo>java -jar "${dist.jar.resolved}"</echo> </target> <target name="-post-jar"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar,jnlp" description="Build JAR." name="jar"/> + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar,jnlp" description="Build JAR." name="jar"/> <!-- ================= EXECUTION SECTION @@ -635,7 +713,7 @@ is divided into following sections: JAVADOC SECTION =============== --> - <target depends="init" name="-javadoc-build"> + <target depends="init" if="have.sources" name="-javadoc-build"> <mkdir dir="${dist.javadoc.dir}"/> <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> <classpath> @@ -669,7 +747,7 @@ is divided into following sections: <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> </target> <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> <copy todir="${build.test.classes.dir}"> <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> </copy> @@ -686,7 +764,7 @@ is divided into following sections: <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> - <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> <copy todir="${build.test.classes.dir}"> <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> </copy> diff --git a/src/redbook/nbproject/genfiles.properties b/src/redbook/nbproject/genfiles.properties index 7e724ad..11539ee 100644 --- a/src/redbook/nbproject/genfiles.properties +++ b/src/redbook/nbproject/genfiles.properties @@ -1,5 +1,5 @@ # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=f7c0fcba -nbproject/build-impl.xml.script.CRC32=d690f492 -nbproject/[email protected] +nbproject/build-impl.xml.script.CRC32=a7700f85 +nbproject/[email protected] diff --git a/src/redbook/src/glredbook10/bezcurve.java b/src/redbook/src/glredbook10/bezcurve.java index 2399d4f..7e9e67e 100644 --- a/src/redbook/src/glredbook10/bezcurve.java +++ b/src/redbook/src/glredbook10/bezcurve.java @@ -7,7 +7,7 @@ import java.nio.FloatBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import javax.media.opengl.awt.GLJPanel;
@@ -23,7 +23,7 @@ public class bezcurve// { -2.0f, 4.0f, 0.0f }, { 2.0f, -4.0f, 0.0f }, { 4.0f, 4.0f, 0.0f } };
private FloatBuffer ctrlpointBuf;
- // = BufferUtil.newFloatBuffer(ctrlpoints[0].length * ctrlpoints.length);
+ // = GLBuffers.newDirectFloatBuffer(ctrlpoints[0].length * ctrlpoints.length);
@Override
protected GLJPanel createDrawable() {
@@ -55,7 +55,7 @@ public class bezcurve// public void init(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
// need to convert 2d array to buffer type
- ctrlpointBuf = BufferUtil.newFloatBuffer(ctrlpoints[0].length
+ ctrlpointBuf = GLBuffers.newDirectFloatBuffer(ctrlpoints[0].length
* ctrlpoints.length);
for (int i = 0; i < ctrlpoints.length; i++) {
ctrlpointBuf.put(ctrlpoints[i]);
diff --git a/src/redbook/src/glredbook10/bezmesh.java b/src/redbook/src/glredbook10/bezmesh.java index 1dbc239..1dda4e0 100644 --- a/src/redbook/src/glredbook10/bezmesh.java +++ b/src/redbook/src/glredbook10/bezmesh.java @@ -6,7 +6,7 @@ import javax.swing.*; import java.nio.*;
import javax.media.opengl.*;
-import com.jogamp.opengl.util.*;
+import com.jogamp.gluegen.runtime.Buffers;
import javax.media.opengl.awt.GLJPanel;
/**
@@ -29,9 +29,7 @@ public class bezmesh// { { -1.5f, 1.5f, -2.0f }, { -0.5f, 1.5f, -2.0f },
{ 0.5f, 1.5f, 0.0f }, { 1.5f, 1.5f, -1.0f } } };
// need float buffer instead of n-dimensional array above
- private FloatBuffer ctrlpointsBuf = BufferUtil
- .newFloatBuffer(ctrlpoints.length * ctrlpoints[0].length
- * ctrlpoints[0][0].length);
+ private FloatBuffer ctrlpointsBuf = Buffers.newDirectFloatBuffer(ctrlpoints.length * ctrlpoints[0].length * ctrlpoints[0][0].length);
{// SO copy 4x4x3 array above to float buffer
for (int i = 0; i < ctrlpoints.length; i++) {
// System.out.print(ctrlpoints.length+ " ");
diff --git a/src/redbook/src/glredbook10/bezsurf.java b/src/redbook/src/glredbook10/bezsurf.java index 1503fd2..96faa8e 100644 --- a/src/redbook/src/glredbook10/bezsurf.java +++ b/src/redbook/src/glredbook10/bezsurf.java @@ -6,7 +6,7 @@ import javax.swing.*; import java.nio.*;
import javax.media.opengl.*;
-import com.jogamp.opengl.util.*;
+import com.jogamp.gluegen.runtime.Buffers;
import javax.media.opengl.awt.GLJPanel;
/**
@@ -29,9 +29,7 @@ public class bezsurf// { { -1.5f, 1.5f, -2.0f }, { -0.5f, 1.5f, -2.0f },
{ 0.5f, 1.5f, 0.0f }, { 1.5f, 1.5f, -1.0f } } };
// need float buffer instead of n-dimensional array above
- private FloatBuffer ctrlpointsBuf = BufferUtil
- .newFloatBuffer(ctrlpoints.length * ctrlpoints[0].length
- * ctrlpoints[0][0].length);
+ private FloatBuffer ctrlpointsBuf = Buffers.newDirectFloatBuffer(ctrlpoints.length * ctrlpoints[0].length * ctrlpoints[0][0].length);
{// SO copy 4x4x3 array above to float buffer
for (int i = 0; i < ctrlpoints.length; i++) {
// System.out.print(ctrlpoints.length+ " ");
diff --git a/src/redbook/src/glredbook10/checker.java b/src/redbook/src/glredbook10/checker.java index c92a6d1..5da7024 100644 --- a/src/redbook/src/glredbook10/checker.java +++ b/src/redbook/src/glredbook10/checker.java @@ -28,7 +28,7 @@ public class checker // // private byte checkImage[][][] = new
// byte[checkImageWidth][checkImageHeight][color];
private ByteBuffer checkImageBuf = //
- BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * color);
+ GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * color);
@Override
protected GLJPanel createDrawable() {
diff --git a/src/redbook/src/glredbook10/checker2.java b/src/redbook/src/glredbook10/checker2.java index 7c41110..20a3dd5 100644 --- a/src/redbook/src/glredbook10/checker2.java +++ b/src/redbook/src/glredbook10/checker2.java @@ -27,7 +27,7 @@ public class checker2// private static final int color = 3;
private byte checkImage[][][] = new byte[checkImageWidth][checkImageHeight][color];
private ByteBuffer checkImageBuf = //
- BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * color);
+ GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * color);
@Override
protected GLJPanel createDrawable() {
diff --git a/src/redbook/src/glredbook10/chess.java b/src/redbook/src/glredbook10/chess.java index fcbf4e9..beb9f7a 100644 --- a/src/redbook/src/glredbook10/chess.java +++ b/src/redbook/src/glredbook10/chess.java @@ -26,7 +26,7 @@ public class chess// private static final int color = 3;
// private byte checkImage[][][] = new byte[checkImageWidth][checkImageHeight][color];
private ByteBuffer checkImageBuf = //
- BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * color);
+ GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * color);
@Override
protected GLJPanel createDrawable() {
diff --git a/src/redbook/src/glredbook10/feedback.java b/src/redbook/src/glredbook10/feedback.java index 9f26aee..b824a55 100644 --- a/src/redbook/src/glredbook10/feedback.java +++ b/src/redbook/src/glredbook10/feedback.java @@ -56,7 +56,7 @@ public class feedback// GL2 gl = drawable.getGL().getGL2();
//
float feedBuffer[] = new float[1024];
- FloatBuffer feedBuf = BufferUtil.newFloatBuffer(1024);
+ FloatBuffer feedBuf = GLBuffers.newDirectFloatBuffer(1024);
int size;
gl.glMatrixMode(GL2.GL_PROJECTION);
diff --git a/src/redbook/src/glredbook10/font.java b/src/redbook/src/glredbook10/font.java index 8019bd4..accc262 100644 --- a/src/redbook/src/glredbook10/font.java +++ b/src/redbook/src/glredbook10/font.java @@ -108,7 +108,7 @@ public class font // }
private void printString(GL2 gl, String s) {
- ByteBuffer str = BufferUtil.newByteBuffer(s.length());
+ ByteBuffer str = GLBuffers.newDirectByteBuffer(s.length());
str.put(s.getBytes());
str.rewind();
//
@@ -359,7 +359,7 @@ public class font // { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, (byte) 0x8f,
(byte) 0xf1, 0x60, 0x00, 0x00, 0x00 } };
private ByteBuffer rastersBuf = //
- BufferUtil.newByteBuffer(rasters.length * rasters[0].length);
+ GLBuffers.newDirectByteBuffer(rasters.length * rasters[0].length);
{
for (int i = 0; i < rasters.length; i++)
rastersBuf.put((byte[]) rasters[i]);// put each array into byte
diff --git a/src/redbook/src/glredbook10/mipmap.java b/src/redbook/src/glredbook10/mipmap.java index b8bfe83..3533acd 100644 --- a/src/redbook/src/glredbook10/mipmap.java +++ b/src/redbook/src/glredbook10/mipmap.java @@ -5,6 +5,7 @@ import javax.swing.*; import java.nio.*;
+import com.jogamp.gluegen.runtime.Buffers;
import javax.media.opengl.*;
import com.jogamp.opengl.util.*;
import javax.media.opengl.awt.GLJPanel;
@@ -29,18 +30,12 @@ public class mipmap// // private byte mipmapImage4[][][] = new byte[4][4][color];
// private byte mipmapImage2[][][] = new byte[2][2][color];
// private byte mipmapImage1[][][] = new byte[1][1][color];
- private ByteBuffer mipmapImage32Buf = BufferUtil
- .newByteBuffer(32 * 32 * color);
- private ByteBuffer mipmapImage16Buf = BufferUtil
- .newByteBuffer(16 * 16 * color);
- private ByteBuffer mipmapImage8Buf = BufferUtil
- .newByteBuffer(8 * 8 * color);
- private ByteBuffer mipmapImage4Buf = BufferUtil
- .newByteBuffer(4 * 4 * color);
- private ByteBuffer mipmapImage2Buf = BufferUtil
- .newByteBuffer(2 * 2 * color);
- private ByteBuffer mipmapImage1Buf = BufferUtil
- .newByteBuffer(1 * 1 * color);
+ private ByteBuffer mipmapImage32Buf = Buffers.newDirectByteBuffer(32 * 32 * color);
+ private ByteBuffer mipmapImage16Buf = Buffers.newDirectByteBuffer(16 * 16 * color);
+ private ByteBuffer mipmapImage8Buf = Buffers.newDirectByteBuffer(8 * 8 * color);
+ private ByteBuffer mipmapImage4Buf = Buffers.newDirectByteBuffer(4 * 4 * color);
+ private ByteBuffer mipmapImage2Buf = Buffers.newDirectByteBuffer(2 * 2 * color);
+ private ByteBuffer mipmapImage1Buf = Buffers.newDirectByteBuffer(1 * 1 * color);
@Override
protected GLJPanel createDrawable() {
diff --git a/src/redbook/src/glredbook10/pickdepth.java b/src/redbook/src/glredbook10/pickdepth.java index e7979a2..2426702 100644 --- a/src/redbook/src/glredbook10/pickdepth.java +++ b/src/redbook/src/glredbook10/pickdepth.java @@ -146,7 +146,7 @@ public class pickdepth// */
private void pickRects(GL2 gl) {
int[] selectBuf = new int[BUFSIZE];
- IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE);
+ IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE);
int hits;
int viewport[] = new int[4];
// int x, y;
diff --git a/src/redbook/src/glredbook10/pickline.java b/src/redbook/src/glredbook10/pickline.java index 8d7eb4b..bb6b5c7 100644 --- a/src/redbook/src/glredbook10/pickline.java +++ b/src/redbook/src/glredbook10/pickline.java @@ -112,7 +112,7 @@ public class pickline// */
private void pickLine(GL2 gl) {
int selectBuf[] = new int[BUFSIZE];
- IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE);
+ IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE);
int hits;
int viewport[] = new int[4];
diff --git a/src/redbook/src/glredbook10/picksquare.java b/src/redbook/src/glredbook10/picksquare.java index 0087e79..2d9ff14 100644 --- a/src/redbook/src/glredbook10/picksquare.java +++ b/src/redbook/src/glredbook10/picksquare.java @@ -152,7 +152,7 @@ public class picksquare// // private void pickSquares(GL2 gl, int button, int state, int x, int y)
private void pickSquares(GL2 gl) {
int selectBuf[] = new int[BUFSIZE];
- IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE);
+ IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE);
int hits;
int viewport[] = new int[4];
diff --git a/src/redbook/src/glredbook10/select.java b/src/redbook/src/glredbook10/select.java index 98609c2..8943228 100644 --- a/src/redbook/src/glredbook10/select.java +++ b/src/redbook/src/glredbook10/select.java @@ -196,7 +196,7 @@ public class select// private void selectObjects(GL2 gl)
{
int selectBuf[] = new int[BUFSIZE];
- IntBuffer selectBuffer = BufferUtil.newIntBuffer(BUFSIZE);
+ IntBuffer selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE);
int hits;
gl.glSelectBuffer(BUFSIZE, selectBuffer);
diff --git a/src/redbook/src/glredbook10/stroke.java b/src/redbook/src/glredbook10/stroke.java index f8b4791..081ba3d 100644 --- a/src/redbook/src/glredbook10/stroke.java +++ b/src/redbook/src/glredbook10/stroke.java @@ -210,7 +210,7 @@ public class stroke// // private void printStrokedString(char *s)
private void printStrokedString(GL2 gl, String s) {
int len = s.length();
- ByteBuffer str = BufferUtil.newByteBuffer(len);
+ ByteBuffer str = GLBuffers.newDirectByteBuffer(len);
str.put(s.getBytes());
str.rewind();
gl.glCallLists(len, GL.GL_BYTE, str);
diff --git a/src/redbook/src/glredbook10/texgen.java b/src/redbook/src/glredbook10/texgen.java index c94616a..821dae7 100644 --- a/src/redbook/src/glredbook10/texgen.java +++ b/src/redbook/src/glredbook10/texgen.java @@ -5,7 +5,7 @@ import javax.swing.*; import java.nio.*;
-import com.jogamp.opengl.util.*;
+import com.jogamp.gluegen.runtime.Buffers;
import com.jogamp.opengl.util.gl2.GLUT;
import javax.media.opengl.*; import javax.media.opengl.awt.GLJPanel;
@@ -22,8 +22,7 @@ public class texgen// private static final int stripeImageWidth = 32;
private byte stripeImage[] = new byte[3 * stripeImageWidth];
- private ByteBuffer stripeImageBuf = BufferUtil
- .newByteBuffer(stripeImage.length);
+ private ByteBuffer stripeImageBuf = Buffers.newDirectByteBuffer(stripeImage.length);
/* glTexGen stuff: */
private float sgenparams[] = { 1.0f, 1.0f, 1.0f, 0.0f };
diff --git a/src/redbook/src/glredbook10/texturesurf.java b/src/redbook/src/glredbook10/texturesurf.java index 34f561d..3c4d947 100644 --- a/src/redbook/src/glredbook10/texturesurf.java +++ b/src/redbook/src/glredbook10/texturesurf.java @@ -6,7 +6,7 @@ import java.awt.event.*; import java.nio.*;
-import com.jogamp.opengl.util.*;
+import com.jogamp.gluegen.runtime.Buffers;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLJPanel;
@@ -20,6 +20,7 @@ import javax.media.opengl.awt.GLJPanel; public class texturesurf//
extends GLSkeleton<GLJPanel>
implements GLEventListener, KeyListener {
+
// as from C version of file
private static final float ctrlpoints[][][] = new float[][][] {
{ { -1.5f, -1.5f, 4.0f }, { -0.5f, -1.5f, 2.0f },
@@ -30,10 +31,10 @@ public class texturesurf// { 0.5f, 0.5f, 3.0f }, { 1.5f, 0.5f, 4.0f } },
{ { -1.5f, 1.5f, -2.0f }, { -0.5f, 1.5f, -2.0f },
{ 0.5f, 1.5f, 0.0f }, { 1.5f, 1.5f, -1.0f } } };
+
// need float buffer instead of n-dimensional array above
- private FloatBuffer ctrlpointsBuf = BufferUtil
- .newFloatBuffer(ctrlpoints.length * ctrlpoints[0].length
- * ctrlpoints[0][0].length);
+ private FloatBuffer ctrlpointsBuf = Buffers.newDirectFloatBuffer(ctrlpoints.length * ctrlpoints[0].length * ctrlpoints[0][0].length);
+
{// SO copy 4x4x3 array above to float buffer
for (int i = 0; i < ctrlpoints.length; i++)
// System.out.print(ctrlpoints.length+ " ");
@@ -51,9 +52,7 @@ public class texturesurf// private float[][][] texpts = new float[][][] {
{ { 0.0f, 0.0f }, { 0.0f, 1.0f } },
{ { 1.0f, 0.0f }, { 1.0f, 1.0f } } };
- private FloatBuffer texptsBuf = BufferUtil
- //
- .newFloatBuffer(texpts.length * texpts[0].length * texpts[1].length);
+ private FloatBuffer texptsBuf = Buffers.newDirectFloatBuffer(texpts.length * texpts[0].length * texpts[1].length);
{
for (int i = 0; i < texpts.length; i++)
// System.out.print(ctrlpoints.length+ " ");
@@ -72,7 +71,7 @@ public class texturesurf// private static final int imageWidth = 64;
private static final int imageHeight = 64;
private static byte image[] = new byte[3 * imageWidth * imageHeight];
- private static ByteBuffer imageBuf = BufferUtil.newByteBuffer(image.length);
+ private static ByteBuffer imageBuf = Buffers.newDirectByteBuffer(image.length);
@Override
protected GLJPanel createDrawable() {
@@ -104,23 +103,17 @@ public class texturesurf// GL2 gl = drawable.getGL().getGL2();
//
gl.glMap2f(GL2.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, ctrlpointsBuf);
- gl.glMap2f(GL2.GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
- texptsBuf);
+ gl.glMap2f(GL2.GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, texptsBuf);
gl.glEnable(GL2.GL_MAP2_TEXTURE_COORD_2);
gl.glEnable(GL2.GL_MAP2_VERTEX_3);
gl.glMapGrid2f(20, 0.0f, 1.0f, 20, 0.0f, 1.0f);
makeImage();
gl.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_DECAL);
- gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S,
- GL2.GL_REPEAT);
- gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T,
- GL2.GL_REPEAT);
- gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER,
- GL.GL_NEAREST);
- gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER,
- GL.GL_NEAREST);
- gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGB, imageWidth,
- imageHeight, 0, GL2.GL_RGB, GL.GL_UNSIGNED_BYTE, imageBuf);
+ gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_REPEAT);
+ gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_REPEAT);
+ gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
+ gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
+ gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGB, imageWidth, imageHeight, 0, GL2.GL_RGB, GL.GL_UNSIGNED_BYTE, imageBuf);
gl.glEnable(GL2.GL_TEXTURE_2D);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glShadeModel(GL2.GL_FLAT);
@@ -153,8 +146,7 @@ public class texturesurf// gl.glRotatef(85.0f, 1.0f, 1.0f, 1.0f);
}
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged,
- boolean deviceChanged) {
+ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
private void makeImage() {
diff --git a/src/redbook/src/glredbook11/image.java b/src/redbook/src/glredbook11/image.java index eea4d24..7c6d16b 100644 --- a/src/redbook/src/glredbook11/image.java +++ b/src/redbook/src/glredbook11/image.java @@ -22,7 +22,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -50,7 +50,7 @@ public class image // private static final int rgb = 3;
// private byte checkImage[][][];
private ByteBuffer checkImageBuf = //
- BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * rgb);
+ GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * rgb);
private static float zoomFactor = 1.0f;
private static int height;
diff --git a/src/redbook/src/glredbook11/texbind.java b/src/redbook/src/glredbook11/texbind.java index 7991f76..ba29968 100644 --- a/src/redbook/src/glredbook11/texbind.java +++ b/src/redbook/src/glredbook11/texbind.java @@ -9,7 +9,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import javax.media.opengl.awt.GLJPanel;
import javax.media.opengl.glu.GLU;
@@ -30,9 +30,9 @@ public class texbind // // private byte checkImage[][][];
// private byte otherImage[][][];
private ByteBuffer checkImageBuf = //
- BufferUtil.newByteBuffer(checkImageWidth * checkImageHeight * rgba);
+ GLBuffers.newDirectByteBuffer(checkImageWidth * checkImageHeight * rgba);
private ByteBuffer otherImageBuf = //
- BufferUtil.newByteBuffer(checkImageWidth * checkImageHeight * rgba);
+ GLBuffers.newDirectByteBuffer(checkImageWidth * checkImageHeight * rgba);
private int[] texName = new int[2];
@Override
diff --git a/src/redbook/src/glredbook11/texgen.java b/src/redbook/src/glredbook11/texgen.java index 519d88f..353c843 100644 --- a/src/redbook/src/glredbook11/texgen.java +++ b/src/redbook/src/glredbook11/texgen.java @@ -6,9 +6,10 @@ import java.awt.event.KeyEvent; import java.awt.event.KeyListener;
import java.nio.ByteBuffer;
-import javax.media.opengl.*;import javax.swing.JFrame;
+import javax.media.opengl.*;
+import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.gluegen.runtime.Buffers;
import com.jogamp.opengl.util.gl2.GLUT;
import javax.media.opengl.awt.GLJPanel;
@@ -31,8 +32,7 @@ public class texgen// private GLUT glut;
private static final int stripeImageWidth = 32;
private byte stripeImage[] = new byte[3 * stripeImageWidth];
- private ByteBuffer stripeImageBuf = BufferUtil
- .newByteBuffer(stripeImage.length);
+ private ByteBuffer stripeImageBuf = Buffers.newDirectByteBuffer(stripeImage.length);
/* glTexGen stuff: */
// private float sgenparams[] = { 1.0f, 1.0f, 1.0f, 0.0f };
private int texName[] = new int[1];
diff --git a/src/redbook/src/glredbook11/texsub.java b/src/redbook/src/glredbook11/texsub.java index 32b7d7d..645745d 100644 --- a/src/redbook/src/glredbook11/texsub.java +++ b/src/redbook/src/glredbook11/texsub.java @@ -9,7 +9,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import javax.media.opengl.awt.GLJPanel;
import javax.media.opengl.glu.GLU;
@@ -35,9 +35,9 @@ public class texsub // private byte checkImage[][][];
// private byte otherImage[][][];
private ByteBuffer checkImageBuf = //
- BufferUtil.newByteBuffer(checkImageWidth * checkImageHeight * rgba);
+ GLBuffers.newDirectByteBuffer(checkImageWidth * checkImageHeight * rgba);
private ByteBuffer subImageBuf = //
- BufferUtil.newByteBuffer(subImageWidth * subImageHeight * rgba);
+ GLBuffers.newDirectByteBuffer(subImageWidth * subImageHeight * rgba);
private int[] texName = new int[2];
@Override
diff --git a/src/redbook/src/glredbook11/varray.java b/src/redbook/src/glredbook11/varray.java index a40b994..d235296 100644 --- a/src/redbook/src/glredbook11/varray.java +++ b/src/redbook/src/glredbook11/varray.java @@ -12,7 +12,7 @@ import java.nio.IntBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import javax.media.opengl.awt.GLJPanel;
import javax.media.opengl.glu.GLU;
@@ -96,7 +96,7 @@ public class varray// } else if (derefMethod == DRAWELEMENTS) {
int indices[] = new int[] { 0, 1, 3, 4 };
if (indicesBuf == null) {
- indicesBuf = BufferUtil.newIntBuffer(indices.length);
+ indicesBuf = GLBuffers.newDirectIntBuffer(indices.length);
indicesBuf.put(indices);
}
indicesBuf.rewind();
@@ -135,11 +135,11 @@ public class varray// 0.5f, 0.5f, 0.5f };
if (verticesBuf == null) {// IntBuffer tmpVerticesBuf
- verticesBuf = BufferUtil.newIntBuffer(vertices.length);
+ verticesBuf = GLBuffers.newDirectIntBuffer(vertices.length);
verticesBuf.put(vertices);
}
if (colorsBuf == null) {
- colorsBuf = BufferUtil.newFloatBuffer(colors.length);
+ colorsBuf = GLBuffers.newDirectFloatBuffer(colors.length);
colorsBuf.put(colors);
}
verticesBuf.rewind();
@@ -160,7 +160,7 @@ public class varray// 0.2f, 1.0f, 1.0f, 300.0f, 200.0f, 0.0f, 0.2f, 0.2f, 1.0f,
200.0f, 100.0f, 0.0f };
if (intertwinedBuf == null) {
- intertwinedBuf = BufferUtil.newFloatBuffer(intertwined.length);
+ intertwinedBuf = GLBuffers.newDirectFloatBuffer(intertwined.length);
intertwinedBuf.put(intertwined);
}
diff --git a/src/redbook/src/glredbook11/wrap.java b/src/redbook/src/glredbook11/wrap.java index 778db3a..47662a4 100644 --- a/src/redbook/src/glredbook11/wrap.java +++ b/src/redbook/src/glredbook11/wrap.java @@ -7,7 +7,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -34,7 +34,7 @@ public class wrap// private static final int rgba = 4;
// private byte[][][] checkImage;
private ByteBuffer checkImageBuf = //
- BufferUtil.newByteBuffer(checkImageHeight * checkImageWidth * rgba);
+ GLBuffers.newDirectByteBuffer(checkImageHeight * checkImageWidth * rgba);
private KeyEvent key;
@Override
diff --git a/src/redbook/src/glredbook12x/colormatrix.java b/src/redbook/src/glredbook12x/colormatrix.java index 7662915..9f4748f 100644 --- a/src/redbook/src/glredbook12x/colormatrix.java +++ b/src/redbook/src/glredbook12x/colormatrix.java @@ -11,7 +11,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -135,7 +135,7 @@ public class colormatrix// System.out.println("Creating buffer, width: " + dim.width
+ " height: " + dim.height);
// byte[] buf = new byte[3 * dim.height * dim.width];
- bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height);
+ bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height);
for (int i = 0; i < bytes.capacity(); i++) {
bytes.put(dis.readByte());
// int b = dis.readByte();// dis.read();
diff --git a/src/redbook/src/glredbook12x/colortable.java b/src/redbook/src/glredbook12x/colortable.java index 4f5fd5e..0564b26 100644 --- a/src/redbook/src/glredbook12x/colortable.java +++ b/src/redbook/src/glredbook12x/colortable.java @@ -12,7 +12,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -74,7 +74,7 @@ public class colortable// }
// byte colorTable[][] = new byte[256][3];
- ByteBuffer colorTableBuf = BufferUtil.newByteBuffer(256 * 3);
+ ByteBuffer colorTableBuf = GLBuffers.newDirectByteBuffer(256 * 3);
gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
@@ -157,7 +157,7 @@ public class colortable// System.out.println("Creating buffer, width: " + dim.width
+ " height: " + dim.height);
// byte[] buf = new byte[3 * dim.height * dim.width];
- bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height);
+ bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height);
for (int i = 0; i < bytes.capacity(); i++) {
bytes.put(dis.readByte());
// int b = dis.readByte();// dis.read();
diff --git a/src/redbook/src/glredbook12x/convolution.java b/src/redbook/src/glredbook12x/convolution.java index 3f4fbdf..9e6d72e 100644 --- a/src/redbook/src/glredbook12x/convolution.java +++ b/src/redbook/src/glredbook12x/convolution.java @@ -14,7 +14,7 @@ import javax.media.opengl.*; import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -27,6 +27,7 @@ import javax.media.opengl.awt.GLJPanel; public class convolution//
extends GLSkeleton<GLJPanel>
implements GLEventListener, KeyListener {
+
private JFrame frame;
private KeyEvent key;
//
@@ -41,12 +42,9 @@ public class convolution// private float laplacian[][] = { { -0.125f, -0.125f, -0.125f },
{ -0.125f, 1.0f, -0.125f }, { -0.125f, -0.125f, -0.125f } };
- private FloatBuffer horizontalBuf = BufferUtil
- .newFloatBuffer(horizontal.length * horizontal[0].length);
- private FloatBuffer verticalBuf = BufferUtil.newFloatBuffer(vertical.length
- * vertical[0].length);
- private FloatBuffer laplacianBuf = BufferUtil
- .newFloatBuffer(laplacian.length * laplacian[0].length);
+ private FloatBuffer horizontalBuf = GLBuffers.newDirectFloatBuffer(horizontal.length * horizontal[0].length);
+ private FloatBuffer verticalBuf = GLBuffers.newDirectFloatBuffer(vertical.length * vertical[0].length);
+ private FloatBuffer laplacianBuf = GLBuffers.newDirectFloatBuffer(laplacian.length * laplacian[0].length);
{
for (int i = 0; i < 3; i++) {
horizontalBuf.put(horizontal[i]);
@@ -190,7 +188,7 @@ public class convolution// System.out.println("Creating buffer, width: " + dim.width
+ " height: " + dim.height);
// byte[] buf = new byte[3 * dim.height * dim.width];
- bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height);
+ bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height);
for (int i = 0; i < bytes.capacity(); i++) {
bytes.put(dis.readByte());
// int b = dis.readByte();// dis.read();
diff --git a/src/redbook/src/glredbook12x/histogram.java b/src/redbook/src/glredbook12x/histogram.java index dd3bb62..2fabe52 100644 --- a/src/redbook/src/glredbook12x/histogram.java +++ b/src/redbook/src/glredbook12x/histogram.java @@ -14,7 +14,7 @@ import javax.media.opengl.*; import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -110,7 +110,7 @@ public class histogram // }// key sw
// short values[][] = new short[HISTOGRAM_SIZE][3];
- ShortBuffer values = BufferUtil.newShortBuffer(HISTOGRAM_SIZE * 3);
+ ShortBuffer values = GLBuffers.newDirectShortBuffer(HISTOGRAM_SIZE * 3);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glRasterPos2i(1, 1);
@@ -183,7 +183,7 @@ public class histogram // System.out.println("Creating buffer, width: " + dim.width
+ " height: " + dim.height);
// byte[] buf = new byte[3 * dim.height * dim.width];
- bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height);
+ bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height);
for (int i = 0; i < bytes.capacity(); i++) {
bytes.put(dis.readByte());
// int b = dis.readByte();// dis.read();
diff --git a/src/redbook/src/glredbook12x/minmax.java b/src/redbook/src/glredbook12x/minmax.java index c7e40b4..6f35328 100644 --- a/src/redbook/src/glredbook12x/minmax.java +++ b/src/redbook/src/glredbook12x/minmax.java @@ -12,7 +12,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -90,7 +90,7 @@ public class minmax// gl.glClear(GL.GL_COLOR_BUFFER_BIT);
// byte [] values=new byte[6];
- ByteBuffer values = BufferUtil.newByteBuffer(6);
+ ByteBuffer values = GLBuffers.newDirectByteBuffer(6);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glRasterPos2i(1, 1);
@@ -141,7 +141,7 @@ public class minmax// System.out.println("Creating buffer, width: " + dim.width
+ " height: " + dim.height);
- bytes = BufferUtil.newByteBuffer(3 * dim.width * dim.height);
+ bytes = GLBuffers.newDirectByteBuffer(3 * dim.width * dim.height);
for (int i = 0; i < bytes.capacity(); i++) {
bytes.put(dis.readByte());
diff --git a/src/redbook/src/glredbook12x/multitex.java b/src/redbook/src/glredbook12x/multitex.java index 3cda5f7..f243739 100644 --- a/src/redbook/src/glredbook12x/multitex.java +++ b/src/redbook/src/glredbook12x/multitex.java @@ -12,7 +12,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import javax.media.opengl.awt.GLJPanel;
import javax.media.opengl.glu.GLU;
@@ -27,8 +27,8 @@ public class multitex // private GLU glu;
// private byte[][][] texels0 = new byte[32][32][4];
// private byte[][][] texels1 = new byte[16][16][4];
- private ByteBuffer texelsBuf0 = BufferUtil.newByteBuffer(32 * 32 * 4);
- private ByteBuffer texelsBuf1 = BufferUtil.newByteBuffer(16 * 16 * 4);
+ private ByteBuffer texelsBuf0 = GLBuffers.newDirectByteBuffer(32 * 32 * 4);
+ private ByteBuffer texelsBuf1 = GLBuffers.newDirectByteBuffer(16 * 16 * 4);
@Override
protected GLJPanel createDrawable() {
diff --git a/src/redbook/src/glredbook12x/texture3d.java b/src/redbook/src/glredbook12x/texture3d.java index 7258ec1..240ca0b 100644 --- a/src/redbook/src/glredbook12x/texture3d.java +++ b/src/redbook/src/glredbook12x/texture3d.java @@ -10,7 +10,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -32,7 +32,7 @@ public class texture3d // private static final int iDepth = 16;
private static final int iRgb = 3;
private ByteBuffer image
- = BufferUtil.newByteBuffer(iRgb * iWidth * iHeight * iDepth);
+ = GLBuffers.newDirectByteBuffer(iRgb * iWidth * iHeight * iDepth);
private int texName[] = new int[1];
@Override
diff --git a/src/redbook/src/glredbook1314/combiner.java b/src/redbook/src/glredbook1314/combiner.java index fbab5de..bf34c23 100644 --- a/src/redbook/src/glredbook1314/combiner.java +++ b/src/redbook/src/glredbook1314/combiner.java @@ -7,7 +7,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import glredbook10.GLSkeleton;
import javax.media.opengl.awt.GLJPanel;
@@ -40,9 +40,9 @@ public class combiner// // private static byte[][][] image1 = new
// byte[imageHeight][imageWidth][imageColor];
private static ByteBuffer imageBuf0 //
- = BufferUtil.newByteBuffer(imageWidth * imageHeight * imageColor);
+ = GLBuffers.newDirectByteBuffer(imageWidth * imageHeight * imageColor);
private static ByteBuffer imageBuf1 //
- = BufferUtil.newByteBuffer(imageWidth * imageHeight * imageColor);
+ = GLBuffers.newDirectByteBuffer(imageWidth * imageHeight * imageColor);
private static int texName[] = new int[4];
@Override
diff --git a/src/redbook/src/glredbook1314/cubemap.java b/src/redbook/src/glredbook1314/cubemap.java index c116cf8..0b0c03a 100644 --- a/src/redbook/src/glredbook1314/cubemap.java +++ b/src/redbook/src/glredbook1314/cubemap.java @@ -36,17 +36,17 @@ public class cubemap// // private static byte image5[][][] = new byte[imageSize][imageSize][4];
// private static byte image6[][][] = new byte[imageSize][imageSize][4];
private static ByteBuffer imageBuf1 //
- = BufferUtil.newByteBuffer(imageSize * imageSize * 4);
+ = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4);
private static ByteBuffer imageBuf2 //
- = BufferUtil.newByteBuffer(imageSize * imageSize * 4);
+ = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4);
private static ByteBuffer imageBuf3 //
- = BufferUtil.newByteBuffer(imageSize * imageSize * 4);
+ = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4);
private static ByteBuffer imageBuf4 //
- = BufferUtil.newByteBuffer(imageSize * imageSize * 4);
+ = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4);
private static ByteBuffer imageBuf5 //
- = BufferUtil.newByteBuffer(imageSize * imageSize * 4);
+ = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4);
private static ByteBuffer imageBuf6 //
- = BufferUtil.newByteBuffer(imageSize * imageSize * 4);
+ = GLBuffers.newDirectByteBuffer(imageSize * imageSize * 4);
private static double ztrans = 0.0;
diff --git a/src/redbook/src/glredbook1314/mvarray.java b/src/redbook/src/glredbook1314/mvarray.java index 405cfbf..0885d9e 100644 --- a/src/redbook/src/glredbook1314/mvarray.java +++ b/src/redbook/src/glredbook1314/mvarray.java @@ -10,7 +10,7 @@ import java.nio.IntBuffer; import javax.media.opengl.*;
import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import javax.media.opengl.awt.GLJPanel;
import javax.media.opengl.glu.GLU;
@@ -40,7 +40,7 @@ public class mvarray // 300, 250 };
private IntBuffer vertexBuf = //
- BufferUtil.newIntBuffer(vertices.length);
+ GLBuffers.newDirectIntBuffer(vertices.length);
private byte oneIndices[] = { 0, 1, 2, 3, 4, 5, 6 };
@@ -49,8 +49,8 @@ public class mvarray // private int count[] = { 7, 6 };
private ByteBuffer indices[] = {//
- BufferUtil.newByteBuffer(oneIndices.length),
- BufferUtil.newByteBuffer(twoIndices.length) };
+ GLBuffers.newDirectByteBuffer(oneIndices.length),
+ GLBuffers.newDirectByteBuffer(twoIndices.length) };
// static GLvoid * indices[2] = {oneIndices, twoIndices};
{
diff --git a/src/redbook/src/glredbook1314/shadowmap.java b/src/redbook/src/glredbook1314/shadowmap.java index 57da6e9..f20b9d2 100644 --- a/src/redbook/src/glredbook1314/shadowmap.java +++ b/src/redbook/src/glredbook1314/shadowmap.java @@ -8,7 +8,7 @@ import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame;
-import com.jogamp.opengl.util.BufferUtil;
+import com.jogamp.opengl.util.GLBuffers;
import com.jogamp.opengl.util.FPSAnimator;
@@ -232,7 +232,7 @@ public class shadowmap // if (shadowRender && textureOn)
gl.glEnable(GL2.GL_TEXTURE_2D);
}
- FloatBuffer depthImageBuf = BufferUtil.newFloatBuffer(SHADOW_MAP_WIDTH * SHADOW_MAP_HEIGHT);
+ FloatBuffer depthImageBuf = GLBuffers.newDirectFloatBuffer(SHADOW_MAP_WIDTH * SHADOW_MAP_HEIGHT);
private void generateShadowMap(GL2 gl) {
int viewport[] = {0,0,0,0};//new int[4];
@@ -288,7 +288,7 @@ public class shadowmap // // demo.canvas.display();causes overflow!
}
}
- FloatBuffer tmpMatbuf = BufferUtil.newFloatBuffer(16);
+ FloatBuffer tmpMatbuf = GLBuffers.newDirectFloatBuffer(16);
private void generateTextureMatrix(GL2 gl) {
// float tmpMatrix[] = new float[16];
|