summaryrefslogtreecommitdiffstats
path: root/src/demos/es2/perftst
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/es2/perftst')
-rw-r--r--src/demos/es2/perftst/PerfModule.java2
-rwxr-xr-xsrc/demos/es2/perftst/PerfTextLoad.java24
-rwxr-xr-xsrc/demos/es2/perftst/PerfUniLoad.java10
-rwxr-xr-xsrc/demos/es2/perftst/PerfVBOLoad.java12
-rwxr-xr-xsrc/demos/es2/perftst/Perftst.java14
5 files changed, 31 insertions, 31 deletions
diff --git a/src/demos/es2/perftst/PerfModule.java b/src/demos/es2/perftst/PerfModule.java
index 69b9f1a..b472039 100644
--- a/src/demos/es2/perftst/PerfModule.java
+++ b/src/demos/es2/perftst/PerfModule.java
@@ -47,7 +47,7 @@ public abstract class PerfModule {
// Let's manage all our states using ShaderState.
st.attachShaderProgram(gl, sp);
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
}
public static final void put(Buffer buffer, int type, float v) {
diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java
index 30f0ad7..e0a6e2e 100755
--- a/src/demos/es2/perftst/PerfTextLoad.java
+++ b/src/demos/es2/perftst/PerfTextLoad.java
@@ -57,9 +57,9 @@ public class PerfTextLoad extends PerfModule {
// Vertices Data setup
//
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
- GLArrayDataServer vertices = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer vertices = GLArrayDataServer.createGLSL(st, "mgl_Vertex", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
vb.put(0f); vb.put(0f);
@@ -69,7 +69,7 @@ public class PerfTextLoad extends PerfModule {
}
vertices.seal(gl, true);
- GLArrayDataServer texCoords = GLArrayDataServer.createGLSL(gl, "mgl_MultiTexCoord0", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer texCoords = GLArrayDataServer.createGLSL(st, "mgl_MultiTexCoord0", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer cb = (FloatBuffer)texCoords.getBuffer();
cb.put(0f); cb.put(0f);
@@ -86,12 +86,12 @@ public class PerfTextLoad extends PerfModule {
tU[0] = System.currentTimeMillis();
for(int j=0; j<numTextures; j++) {
gl.glActiveTexture(j);
- textures[j].updateImage(textDatas[0]);
+ textures[j].updateImage(gl, textDatas[0]);
tU[j+1] = System.currentTimeMillis();
}
GLUniformData activeTexture = new GLUniformData("mgl_ActiveTexture", 0);
- st.glUniform(gl, activeTexture);
+ st.uniform(gl, activeTexture);
//
// run loops
@@ -116,14 +116,14 @@ public class PerfTextLoad extends PerfModule {
for(int k=0; k<numTextures; k++) {
gl.glActiveTexture(GL.GL_TEXTURE0+k);
- textures[k].enable();
- textures[k].bind();
+ textures[k].enable(gl);
+ textures[k].bind(gl);
activeTexture.setData(k);
- st.glUniform(gl, activeTexture);
+ st.uniform(gl, activeTexture);
t1[i][j][k] = System.currentTimeMillis();
- textures[k].updateSubImage(textDatas[j], 0, 0, 0);
+ textures[k].updateSubImage(gl, textDatas[j], 0, 0, 0);
t2[i][j][k] = System.currentTimeMillis();
@@ -189,11 +189,11 @@ public class PerfTextLoad extends PerfModule {
}
System.out.println("*****************************************************************");
- st.glUseProgram(gl, false);
+ st.useProgram(gl, false);
for(int i=0; i<numTextures; i++) {
- textures[i].disable();
- textures[i].dispose();
+ textures[i].disable(gl);
+ textures[i].destroy(gl);
textures[i]=null;
}
for(int i=0; i<numObjs; i++) {
diff --git a/src/demos/es2/perftst/PerfUniLoad.java b/src/demos/es2/perftst/PerfUniLoad.java
index 1c71253..99621ee 100755
--- a/src/demos/es2/perftst/PerfUniLoad.java
+++ b/src/demos/es2/perftst/PerfUniLoad.java
@@ -35,9 +35,9 @@ public class PerfUniLoad extends PerfModule {
throw new GLException("numArrayElem must be within 0.."+MAX_ARRAY_ELEM);
}
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
- GLArrayDataServer vertices = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 3, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer vertices = GLArrayDataServer.createGLSL(st, "mgl_Vertex", 3, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
vb.put(0f); vb.put(0f); vb.put(0f);
@@ -47,7 +47,7 @@ public class PerfUniLoad extends PerfModule {
}
vertices.seal(gl, true);
- GLArrayDataServer colors = GLArrayDataServer.createGLSL(gl, "mgl_Color", 4, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ GLArrayDataServer colors = GLArrayDataServer.createGLSL(st, "mgl_Color", 4, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
FloatBuffer cb = (FloatBuffer)colors.getBuffer();
cb.put(0f); cb.put(0f); cb.put(0f); cb.put(1f);
@@ -103,7 +103,7 @@ public class PerfUniLoad extends PerfModule {
t0[i] = System.currentTimeMillis();
for(int j=0; j<numObjs; j++) {
- st.glUniform(gl, dummyUni[j]);
+ st.uniform(gl, dummyUni[j]);
t1[i][j] = System.currentTimeMillis();
@@ -155,7 +155,7 @@ public class PerfUniLoad extends PerfModule {
System.out.println("*****************************************************************");
- st.glUseProgram(gl, false);
+ st.useProgram(gl, false);
try {
Thread.sleep(100);
diff --git a/src/demos/es2/perftst/PerfVBOLoad.java b/src/demos/es2/perftst/PerfVBOLoad.java
index d0b4a1d..fcfaff0 100755
--- a/src/demos/es2/perftst/PerfVBOLoad.java
+++ b/src/demos/es2/perftst/PerfVBOLoad.java
@@ -28,8 +28,8 @@ public class PerfVBOLoad extends PerfModule {
float r=1f, g=1f, b=1f;
for(int i=0; i<numObjs; i++) {
- vertices[i] = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 3, dataType, true, numVertices, GL.GL_STATIC_DRAW);
- vertices[i].setVBOUsage(useVBO);
+ vertices[i] = GLArrayDataServer.createGLSL(st, "mgl_Vertex", 3, dataType, true, numVertices, GL.GL_STATIC_DRAW);
+ vertices[i].setVBOEnabled(useVBO);
{
Buffer verticeb = vertices[i].getBuffer();
for(int j=0; j<numVertices; j++) {
@@ -42,8 +42,8 @@ public class PerfVBOLoad extends PerfModule {
if(y>1f) { x=0f; y=0f; z+=0.01f; }
}
}
- colors[i] = GLArrayDataServer.createGLSL(gl, "mgl_Color", 4, dataType, true, numVertices, GL.GL_STATIC_DRAW);
- colors[i].setVBOUsage(useVBO);
+ colors[i] = GLArrayDataServer.createGLSL(st, "mgl_Color", 4, dataType, true, numVertices, GL.GL_STATIC_DRAW);
+ colors[i].setVBOEnabled(useVBO);
{
// Fill them up
Buffer colorb = colors[i].getBuffer();
@@ -74,7 +74,7 @@ public class PerfVBOLoad extends PerfModule {
long[] tS = new long[loops];
// Push the 1st uniform down the path
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
for(int i=0; i<loops; i++) {
tC[i] = System.currentTimeMillis();
@@ -164,7 +164,7 @@ public class PerfVBOLoad extends PerfModule {
}
System.out.println("*****************************************************************");
- st.glUseProgram(gl, false);
+ st.useProgram(gl, false);
for(int i=0; i<numObjs; i++) {
vertices[i].destroy(gl);
diff --git a/src/demos/es2/perftst/Perftst.java b/src/demos/es2/perftst/Perftst.java
index 4860e51..dba9e48 100755
--- a/src/demos/es2/perftst/Perftst.java
+++ b/src/demos/es2/perftst/Perftst.java
@@ -93,17 +93,17 @@ public class Perftst implements MouseListener, GLEventListener {
pmvMatrix = new PMVMatrix();
pmod.initShaderState(gl);
- st = ShaderState.getCurrent();
+ st = ShaderState.getShaderState(gl);
// Push the 1st uniform down the path
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
- if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()))) {
+ if(!st.uniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()))) {
throw new GLException("Error setting PMVMatrix in shader: "+st);
}
@@ -111,7 +111,7 @@ public class Perftst implements MouseListener, GLEventListener {
gl.glClearColor(0, 0, 0, 1);
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- st.glUseProgram(gl, false);
+ st.useProgram(gl, false);
// Let's show the completed shader state ..
System.out.println(st);
@@ -120,7 +120,7 @@ public class Perftst implements MouseListener, GLEventListener {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
// Set location in front of camera
pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
@@ -134,10 +134,10 @@ public class Perftst implements MouseListener, GLEventListener {
GLUniformData ud = st.getUniform("mgl_PMVMatrix");
if(null!=ud) {
// same data object
- st.glUniform(gl, ud);
+ st.uniform(gl, ud);
}
- st.glUseProgram(gl, false);
+ st.useProgram(gl, false);
}
public void dispose(GLAutoDrawable drawable) {