diff options
Diffstat (limited to 'src/demos/es1')
-rwxr-xr-x | src/demos/es1/RedSquare.java | 10 | ||||
-rwxr-xr-x | src/demos/es1/angeles/AngelesGL.java | 16 | ||||
-rwxr-xr-x | src/demos/es1/angeles/AngelesGLil.java | 14 | ||||
-rwxr-xr-x | src/demos/es1/angeles/Main.java | 4 | ||||
-rw-r--r-- | src/demos/es1/cube/Cube.java | 6 | ||||
-rw-r--r-- | src/demos/es1/cube/CubeImmModeSink.java | 4 | ||||
-rwxr-xr-x | src/demos/es1/cubefbo/FBCubes.java | 21 | ||||
-rwxr-xr-x | src/demos/es1/cubefbo/Main.java | 4 |
8 files changed, 40 insertions, 39 deletions
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 1049ee7..951eed0 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -131,12 +131,12 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo window.addKeyListener(this); 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); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); if(!oneThread) { if(useAnimator) { @@ -152,7 +152,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo } else { do { display(); - } while (!quit && window.getDuration() < 11000) ; + } while (!quit && window.getTotalFPSDuration() < 11000) ; shutdown(); } } @@ -213,7 +213,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo glTrace = false; } - GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(_gl); + GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl); if(swapInterval>=0) { gl.setSwapInterval(swapInterval); } @@ -284,7 +284,7 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo gl.glMatrixMode(gl.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -10); - float ang = ((float) window.getDuration() * 360.0f) / 4000.0f; + float ang = ((float) window.getTotalFPSDuration() * 360.0f) / 4000.0f; gl.glRotatef(ang, 0, 0, 1); gl.glRotatef(ang, 0, 1, 0); diff --git a/src/demos/es1/angeles/AngelesGL.java b/src/demos/es1/angeles/AngelesGL.java index bc367d7..42dbf76 100755 --- a/src/demos/es1/angeles/AngelesGL.java +++ b/src/demos/es1/angeles/AngelesGL.java @@ -86,7 +86,7 @@ public class AngelesGL implements GLEventListener { cComps = drawable.getGL().isGLES1() ? 4: 3; - this.gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL()); + this.gl = FixedFuncUtil.wrapFixedFuncEmul(drawable.getGL()); System.err.println("AngelesGL: "+this.gl); this.glu = GLU.createGLU(); @@ -298,14 +298,14 @@ public class GLSpatial { int[] tmp = new int[1]; gl.glGenBuffers(1, tmp, 0); vboName = tmp[0]; - - vArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false, - 0, pBuffer, vboName, vOffset); - cArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false, - 0, pBuffer, vboName, cOffset); + + vArrayData = GLArrayDataWrapper.createFixed(gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false, + 0, pBuffer, vboName, vOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); + cArrayData = GLArrayDataWrapper.createFixed(gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false, + 0, pBuffer, vboName, cOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); if(useNormalArray) { - nArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false, - 0, pBuffer, vboName, nOffset); + nArrayData = GLArrayDataWrapper.createFixed(gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false, + 0, pBuffer, vboName, nOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); } } diff --git a/src/demos/es1/angeles/AngelesGLil.java b/src/demos/es1/angeles/AngelesGLil.java index 92be109..3e96dc1 100755 --- a/src/demos/es1/angeles/AngelesGLil.java +++ b/src/demos/es1/angeles/AngelesGLil.java @@ -82,7 +82,7 @@ public class AngelesGLil implements GLEventListener { cComps = drawable.getGL().isGLES1() ? 4: 3; - this.gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL()); + this.gl = FixedFuncUtil.wrapFixedFuncEmul(drawable.getGL()); System.err.println("AngelesGL: "+this.gl); this.glu = GLU.createGLU(); @@ -298,13 +298,13 @@ public class GLSpatial { interlArray.position(count*(vComps+cComps+nComps)); interlArray.flip(); - vArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false, - bStride, pBuffer, vboName, vOffset); - cArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false, - bStride, pBuffer, vboName, cOffset); + vArrayData = GLArrayDataWrapper.createFixed(gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false, + bStride, pBuffer, vboName, vOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); + cArrayData = GLArrayDataWrapper.createFixed(gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false, + bStride, pBuffer, vboName, cOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); if(useNormalArray) { - nArrayData = GLArrayDataWrapper.createFixed(gl, gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false, - bStride, pBuffer, vboName, nOffset); + nArrayData = GLArrayDataWrapper.createFixed(gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false, + bStride, pBuffer, vboName, nOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); } } diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index 743f961..ad1a5b5 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -75,7 +75,7 @@ public class Main implements WindowListener, MouseListener { window.addWindowListener(this); window.addMouseListener(this); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); window.setSize(width, height); window.setFullscreen(true); window.setVisible(true); @@ -97,7 +97,7 @@ public class Main implements WindowListener, MouseListener { } } - while (!quit && window.getDuration() < 215000) { + while (!quit && window.getTotalFPSDuration() < 215000) { window.display(); } diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index fa88674..001f821 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -95,7 +95,7 @@ public class Cube implements GLEventListener { } catch (Exception e) {e.printStackTrace();} } - GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(_gl); + GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl); glu = GLU.createGLU(); @@ -338,13 +338,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/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java index a75b274..81f89d8 100644 --- a/src/demos/es1/cube/CubeImmModeSink.java +++ b/src/demos/es1/cube/CubeImmModeSink.java @@ -167,7 +167,7 @@ public class CubeImmModeSink implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL()); + GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(drawable.getGL()); glu = GLU.createGLU(); @@ -403,7 +403,7 @@ public class CubeImmModeSink 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); diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java index b6a1b0d..b658798 100755 --- a/src/demos/es1/cubefbo/FBCubes.java +++ b/src/demos/es1/cubefbo/FBCubes.java @@ -45,7 +45,7 @@ public class FBCubes implements GLEventListener { public FBCubes () { cubeOuter = new Cube(true, false); - fbo1 = new FBObject(FBO_SIZE, FBO_SIZE, FBObject.ATTR_DEPTH); + fbo1 = new FBObject(FBO_SIZE, FBO_SIZE); cubeInner = new Cube(false, true); // JAU cubeMiddle = new Cube(true, false); @@ -53,7 +53,7 @@ public class FBCubes implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(drawable.getGL()); + GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(drawable.getGL()); System.out.println(gl); gl.glGetError(); // flush error .. @@ -73,10 +73,13 @@ public class FBCubes implements GLEventListener { }*/ fbo1.init(gl); - //fbo1.init(gl, GL.GL_RGB, GL.GL_RGB, GL.GL_UNSIGNED_BYTE); // faster - //fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); // GLES2 default - //fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_SHORT_5_5_5_1); // useless (1bit alpha) - //fbo1.init(gl, GL.GL_RGBA8, GL2.GL_BGRA, GL2.GL_UNSIGNED_INT_8_8_8_8_REV); // GL2 default + fbo1.attachTexture2D(gl, 0, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0); + fbo1.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); + //fbo1.init(gl, GL.GL_RGB, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0); // faster + //fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0); // GLES2 default + //fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_SHORT_5_5_5_1, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0); // useless (1bit alpha) + //fbo1.init(gl, GL.GL_RGBA8, GL2.GL_BGRA, GL2.GL_UNSIGNED_INT_8_8_8_8_REV, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0); // GL2 default + fbo1.unbind(gl); cubeInner.init(drawable); cubeOuter.init(drawable); @@ -113,13 +116,11 @@ public class FBCubes implements GLEventListener { gl.glFinish(); fbo1.unbind(gl); - gl.glActiveTexture(GL.GL_TEXTURE0); gl.glEnable (gl.GL_TEXTURE_2D); + fbo1.use(gl, 0); cubeOuter.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); - fbo1.use(gl); cubeOuter.display(drawable); - fbo1.unbind(gl); - + fbo1.unuse(gl); gl.glDisable (gl.GL_TEXTURE_2D); // JAUFBObject tex = fbo1; diff --git a/src/demos/es1/cubefbo/Main.java b/src/demos/es1/cubefbo/Main.java index cd26556..b2da7a5 100755 --- a/src/demos/es1/cubefbo/Main.java +++ b/src/demos/es1/cubefbo/Main.java @@ -76,7 +76,7 @@ public class Main implements WindowListener, MouseListener { window.addWindowListener(this); window.addMouseListener(this); - window.enablePerfLog(true); + window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); window.setSize(width, height); window.setFullscreen(false); window.setVisible(true); @@ -85,7 +85,7 @@ public class Main implements WindowListener, MouseListener { FBCubes cubes = new FBCubes(); window.addGLEventListener(cubes); - while ( !quit && window.getDuration() < 31000) { + while ( !quit && window.getTotalFPSDuration() < 31000) { window.display(); } |