diff options
Diffstat (limited to 'src/demos/es2')
-rwxr-xr-x | src/demos/es2/RedSquare.java | 28 | ||||
-rw-r--r-- | src/demos/es2/openmax/Cube.java | 4 | ||||
-rwxr-xr-x | src/demos/es2/openmax/MovieCube.java | 6 | ||||
-rwxr-xr-x | src/demos/es2/openmax/MovieSimple.java | 32 | ||||
-rw-r--r-- | src/demos/es2/perftst/PerfModule.java | 2 | ||||
-rwxr-xr-x | src/demos/es2/perftst/PerfTextLoad.java | 24 | ||||
-rwxr-xr-x | src/demos/es2/perftst/PerfUniLoad.java | 10 | ||||
-rwxr-xr-x | src/demos/es2/perftst/PerfVBOLoad.java | 12 | ||||
-rwxr-xr-x | src/demos/es2/perftst/Perftst.java | 14 |
9 files changed, 66 insertions, 66 deletions
diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index 1d0bcad..c4817a8 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -118,12 +118,12 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo window.setSize(width, height); // window.setFullscreen(true); window.setVisible(true); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); if(!oneThread) { do { display(); - } while (!quit && window.getDuration() < 20000) ; + } while (!quit && window.getTotalFPSDuration() < 20000) ; shutdown(); } @@ -212,18 +212,18 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo initShader(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); } // Allocate vertex arrays - GLArrayDataClient vertices = GLArrayDataClient.createGLSL(gl, "mgl_Vertex", 3, gl.GL_FLOAT, false, 4); + GLArrayDataClient vertices = GLArrayDataClient.createGLSL(st, "mgl_Vertex", 3, gl.GL_FLOAT, false, 4); { // Fill them up FloatBuffer verticeb = (FloatBuffer)vertices.getBuffer(); @@ -234,7 +234,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo } vertices.seal(gl, true); - GLArrayDataClient colors = GLArrayDataClient.createGLSL(gl, "mgl_Color", 4, gl.GL_FLOAT, false, 4); + GLArrayDataClient colors = GLArrayDataClient.createGLSL(st, "mgl_Color", 4, gl.GL_FLOAT, false, 4); { // Fill them up FloatBuffer colorb = (FloatBuffer)colors.getBuffer(); @@ -249,7 +249,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo 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(Thread.currentThread()+" "+st); @@ -260,7 +260,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo GL2ES2 gl = drawable.getGL().getGL2ES2(); - st.glUseProgram(gl, true); + st.useProgram(gl, true); // Set location in front of camera pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION); @@ -271,10 +271,10 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo 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) { @@ -295,7 +295,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo GL2ES2 gl = drawable.getGL().getGL2ES2(); - st.glUseProgram(gl, true); + st.useProgram(gl, true); gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); @@ -303,20 +303,20 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); - float ang = ((float) window.getDuration() * 360.0f) / 4000.0f; + float ang = ((float) window.getTotalFPSDuration() * 360.0f) / 4000.0f; pmvMatrix.glRotatef(ang, 0, 0, 1); pmvMatrix.glRotatef(ang, 0, 1, 0); GLUniformData ud = st.getUniform("mgl_PMVMatrix"); if(null!=ud) { // same data object - st.glUniform(gl, ud); + st.uniform(gl, ud); } // Draw a square gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4); - st.glUseProgram(gl, false); + st.useProgram(gl, false); } public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java index 5d318cf..db09a06 100644 --- a/src/demos/es2/openmax/Cube.java +++ b/src/demos/es2/openmax/Cube.java @@ -330,13 +330,13 @@ public class Cube implements GLEventListener { window.addGLEventListener(this); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); // Size OpenGL to Video Surface window.setSize(width, height); window.setFullscreen(true); window.setVisible(true); - while (!quit && window.getDuration() < 31000) { + while (!quit && window.getTotalFPSDuration() < 31000) { window.display(); } diff --git a/src/demos/es2/openmax/MovieCube.java b/src/demos/es2/openmax/MovieCube.java index 6b53c6d..d992de1 100755 --- a/src/demos/es2/openmax/MovieCube.java +++ b/src/demos/es2/openmax/MovieCube.java @@ -185,13 +185,13 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen tex=movie.getNextTextureID(); if(null!=tex) { System.out.println("Use: "+tex); - tex.enable(); - tex.bind(); + tex.enable(gl); + tex.bind(gl); } } cube.display(drawable); if(null!=tex) { - tex.disable(); + tex.disable(gl); } } diff --git a/src/demos/es2/openmax/MovieSimple.java b/src/demos/es2/openmax/MovieSimple.java index 015d3b5..efcb59b 100755 --- a/src/demos/es2/openmax/MovieSimple.java +++ b/src/demos/es2/openmax/MovieSimple.java @@ -169,17 +169,17 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList initShader(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); } - if(!st.glUniform(gl, new GLUniformData("mgl_ActiveTexture", 0))) { + if(!st.uniform(gl, new GLUniformData("mgl_ActiveTexture", 0))) { throw new GLException("Error setting mgl_ActiveTexture in shader: "+st); } gl.glActiveTexture(GL.GL_TEXTURE0); @@ -197,7 +197,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList } // Allocate vertex array - GLArrayDataServer vertices = GLArrayDataServer.createGLSL(gl, "mgl_Vertex", 3, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); + GLArrayDataServer vertices = GLArrayDataServer.createGLSL(st, "mgl_Vertex", 3, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); { // Fill them up FloatBuffer verticeb = (FloatBuffer)vertices.getBuffer(); @@ -209,7 +209,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList vertices.seal(gl, true); // Allocate texcoord array - GLArrayDataServer texcoord = GLArrayDataServer.createGLSL(gl, "mgl_MultiTexCoord", 2, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); + GLArrayDataServer texcoord = GLArrayDataServer.createGLSL(st, "mgl_MultiTexCoord", 2, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); { // Fill them up FloatBuffer texcoordb = (FloatBuffer)texcoord.getBuffer(); @@ -220,7 +220,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList } texcoord.seal(gl, true); - GLArrayDataServer colors = GLArrayDataServer.createGLSL(gl, "mgl_Color", 4, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); + GLArrayDataServer colors = GLArrayDataServer.createGLSL(st, "mgl_Color", 4, gl.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); { // Fill them up FloatBuffer colorb = (FloatBuffer)colors.getBuffer(); @@ -235,7 +235,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList gl.glClearColor(0.2f, 0.2f, 0.2f, 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); @@ -257,7 +257,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList 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); @@ -272,10 +272,10 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList 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) { @@ -293,7 +293,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList public void display(GLAutoDrawable drawable) { GL2ES2 gl = drawable.getGL().getGL2ES2(); - st.glUseProgram(gl, true); + st.useProgram(gl, true); gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); @@ -312,7 +312,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList GLUniformData ud = st.getUniform("mgl_PMVMatrix"); if(null!=ud) { // same data object - st.glUniform(gl, ud); + st.uniform(gl, ud); } if(!rotate) { @@ -325,8 +325,8 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList if(null!=movie) { tex=movie.getNextTextureID(); if(null!=tex) { - tex.enable(); - tex.bind(); + tex.enable(gl); + tex.bind(gl); } } @@ -334,10 +334,10 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4); if(null!=tex) { - tex.disable(); + tex.disable(gl); } - st.glUseProgram(gl, false); + st.useProgram(gl, false); } public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { 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) { |