summaryrefslogtreecommitdiffstats
path: root/src/demos/es1
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-08-21 17:40:54 +0000
committerSven Gothel <[email protected]>2008-08-21 17:40:54 +0000
commit0b657e84188652ea4e400861f778bdebcd35d6b3 (patch)
treedbac158f594cfcdb01962678fbc54b212a256460 /src/demos/es1
parent53b839d9c65114998b561a9a9f9309dff9636f77 (diff)
ES2 performance test: 1st draft
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@277 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/es1')
-rw-r--r--src/demos/es1/cube/Cube.java36
-rw-r--r--src/demos/es1/cube/CubeImmModeSink.java7
-rwxr-xr-xsrc/demos/es1/cubefbo/Main.java2
3 files changed, 29 insertions, 16 deletions
diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java
index d46e87d..48e1b6b 100644
--- a/src/demos/es1/cube/Cube.java
+++ b/src/demos/es1/cube/Cube.java
@@ -77,6 +77,9 @@ public class Cube implements GLEventListener {
gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
System.err.println("Cubes Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
}
+
+ gl.glGenBuffers(4, vboNames, 0);
+
if(!innerCube) {
System.err.println("Entering initialization");
System.err.println("GL Profile: "+GLProfile.getProfile());
@@ -133,13 +136,32 @@ 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.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.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.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.glTexCoordPointer(2, gl.GL_SHORT, 0, 0);
+ if(null!=glF) {
+ glF.glTexEnvi(glF.GL_TEXTURE_ENV, glF.GL_TEXTURE_ENV_MODE, glF.GL_INCR);
+ }
} else {
gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
}
+ gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
if(null!=glF) {
glF.glHint(glF.GL_PERSPECTIVE_CORRECTION_HINT, glF.GL_FASTEST);
@@ -172,17 +194,6 @@ public class Cube implements GLEventListener {
gl.glRotatef((float)(time * 29.77f), 1.0f, 2.0f, 0.0f);
gl.glRotatef((float)(time * 22.311f), -0.1f, 0.0f, -5.0f);
- gl.glVertexPointer(3, gl.GL_SHORT, 0, cubeVertices);
- gl.glColorPointer(4, gl.GL_FLOAT, 0, cubeColors);
- gl.glNormalPointer(gl.GL_BYTE, 0, cubeNormals);
- if (cubeTexCoords != null) {
- gl.glTexCoordPointer(2, gl.GL_SHORT, 0, cubeTexCoords);
- if(null!=glF) {
- glF.glTexEnvi(glF.GL_TEXTURE_ENV, glF.GL_TEXTURE_ENV_MODE, glF.GL_INCR);
- }
- }
-
-
gl.glDrawElements(gl.GL_TRIANGLES, 6 * 6, gl.GL_UNSIGNED_BYTE, cubeIndices);
// gl.glFinish();
// System.err.println(gl);
@@ -199,6 +210,7 @@ public class Cube implements GLEventListener {
static final float[] material_spec = { 1.0f, 1.0f, 1.0f, 0.f };
static final float[] zero_vec4 = { 0.0f, 0.0f, 0.0f, 0.f };
+ int[] vboNames = new int[4];
boolean innerCube;
boolean initialized = false;
float time = 0.0f;
@@ -311,7 +323,7 @@ public class Cube implements GLEventListener {
window.setFullscreen(true);
window.setVisible(true);
- while (window.getDuration() < 20000) {
+ while (window.getDuration() < 31000) {
window.display();
}
diff --git a/src/demos/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java
index 219e5fd..c0ad4aa 100644
--- a/src/demos/es1/cube/CubeImmModeSink.java
+++ b/src/demos/es1/cube/CubeImmModeSink.java
@@ -43,6 +43,7 @@ public class CubeImmModeSink implements GLEventListener {
this(false, false);
}
+ private static boolean VBO_CACHE = true;
ByteBuffer cubeIndices=null;
ImmModeSink vboCubeF = null;
@@ -78,7 +79,6 @@ public class CubeImmModeSink implements GLEventListener {
if(null!=vboCubeF) {
vboCubeF.draw(gl, cubeIndices, true);
}
- System.err.println("VBO Cube fin");
}
private GLUquadric sphere=null;
@@ -86,6 +86,7 @@ public class CubeImmModeSink implements GLEventListener {
public void drawSphere(GL gl, float radius, int slices, int stacks) {
if(sphere==null) {
sphere = glu.gluNewQuadric();
+ sphere.enableImmModeSink(true);
sphere.setImmMode((VBO_CACHE)?false:true);
}
ImmModeSink vbo = vboSphere;
@@ -105,12 +106,12 @@ public class CubeImmModeSink implements GLEventListener {
}
- private static boolean VBO_CACHE = true;
private GLUquadric cylinder=null;
private ImmModeSink vboCylinder=null;
public void drawCylinder(GL gl, float radius, float halfHeight, int upAxis) {
if(cylinder==null) {
cylinder = glu.gluNewQuadric();
+ cylinder.enableImmModeSink(true);
cylinder.setImmMode((VBO_CACHE)?false:true);
}
@@ -409,7 +410,7 @@ public class CubeImmModeSink implements GLEventListener {
long curTime;
long startTime = System.currentTimeMillis();
- while (((curTime = System.currentTimeMillis()) - startTime) < 20000) {
+ while (((curTime = System.currentTimeMillis()) - startTime) < 31000) {
window.display();
}
diff --git a/src/demos/es1/cubefbo/Main.java b/src/demos/es1/cubefbo/Main.java
index b23b221..cc43ebf 100755
--- a/src/demos/es1/cubefbo/Main.java
+++ b/src/demos/es1/cubefbo/Main.java
@@ -67,7 +67,7 @@ public class Main implements MouseListener {
FBCubes cubes = new FBCubes();
window.addGLEventListener(cubes);
- while ( !quit && window.getDuration() < 215000) {
+ while ( !quit && window.getDuration() < 31000) {
window.display();
}