summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/demos/es2/perftst/PerfTextLoad.java48
-rwxr-xr-xsrc/demos/es2/perftst/PerfUniLoad.java59
-rwxr-xr-xsrc/demos/es2/perftst/PerfVBOLoad.java68
-rwxr-xr-xsrc/demos/readbuffer/ReadBuffer2Screen.java58
4 files changed, 123 insertions, 110 deletions
diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java
index 971ab32..677b742 100755
--- a/src/demos/es2/perftst/PerfTextLoad.java
+++ b/src/demos/es2/perftst/PerfTextLoad.java
@@ -24,15 +24,15 @@ public class PerfTextLoad extends PerfModule {
}
@Override
- public ShaderState initShaderState(GL2ES2 gl) {
+ public ShaderState initShaderState(final GL2ES2 gl) {
return initShaderState(gl, "vbo-vert-text", "ftext");
}
Texture[] textures = null;
TextureData[] textDatas = null;
- protected void runOneSet(GLAutoDrawable drawable, String textBaseName, int numObjs, int numTextures, int loops) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ protected void runOneSet(final GLAutoDrawable drawable, final String textBaseName, final int numObjs, final int numTextures, final int loops) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
if(numTextures>MAX_TEXTURE_ENGINES) {
throw new GLException("numTextures must be within 1.."+MAX_TEXTURE_ENGINES);
@@ -44,7 +44,7 @@ public class PerfTextLoad extends PerfModule {
try {
for(int i=0; i<numObjs; i++) {
textName = "data/"+textBaseName+"."+(i+1)+".tga";
- URLConnection connText = IOUtil.getResource(textName, Perftst.class.getClassLoader(), Perftst.class);
+ final URLConnection connText = IOUtil.getResource(textName, Perftst.class.getClassLoader(), Perftst.class);
if(connText==null) {
throw new RuntimeException("couldn't fetch "+textName);
}
@@ -61,7 +61,7 @@ public class PerfTextLoad extends PerfModule {
gl.glActiveTexture(i);
textures[i] = new Texture(GL.GL_TEXTURE_2D);
}
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
System.err.println("couldn't fetch "+textName);
throw new RuntimeException(ioe);
}
@@ -72,9 +72,9 @@ public class PerfTextLoad extends PerfModule {
st.useProgram(gl, true);
- GLArrayDataServer vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ final GLArrayDataServer vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
- FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
+ final FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
vb.put(0f); vb.put(0f);
vb.put(1f); vb.put(0f);
vb.put(0f); vb.put(1f);
@@ -82,9 +82,9 @@ public class PerfTextLoad extends PerfModule {
}
vertices.seal(gl, true);
- GLArrayDataServer texCoords = GLArrayDataServer.createGLSL("mgl_MultiTexCoord0", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ final GLArrayDataServer texCoords = GLArrayDataServer.createGLSL("mgl_MultiTexCoord0", 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
- FloatBuffer cb = (FloatBuffer)texCoords.getBuffer();
+ final FloatBuffer cb = (FloatBuffer)texCoords.getBuffer();
cb.put(0f); cb.put(0f);
cb.put(1f); cb.put(0f);
cb.put(0f); cb.put(1f);
@@ -95,7 +95,7 @@ public class PerfTextLoad extends PerfModule {
//
// texture setup
//
- long[] tU = new long[numObjs+1];
+ final long[] tU = new long[numObjs+1];
tU[0] = System.currentTimeMillis();
for(int j=0; j<numTextures; j++) {
gl.glActiveTexture(j);
@@ -103,27 +103,29 @@ public class PerfTextLoad extends PerfModule {
tU[j+1] = System.currentTimeMillis();
}
- GLUniformData activeTexture = new GLUniformData("mgl_ActiveTexture", 0);
+ final GLUniformData activeTexture = new GLUniformData("mgl_ActiveTexture", 0);
st.uniform(gl, activeTexture);
//
// run loops
//
- long dtC, dt, dt2, dt3, dtF, dtS, dtT;
- long[][] tC = new long[loops][numObjs];
- long[][] t0 = new long[loops][numObjs];
- long[][][] t1 = new long[loops][numObjs][numTextures];
- long[][][] t2 = new long[loops][numObjs][numTextures];
- long[][][] t3 = new long[loops][numObjs][numTextures];
- long[][] tF = new long[loops][numObjs];
- long[][] tS = new long[loops][numObjs];
+ long dtC, dt;
+ final long dt2, dt3;
+ long dtF, dtS, dtT;
+ final long[][] tC = new long[loops][numObjs];
+ final long[][] t0 = new long[loops][numObjs];
+ final long[][][] t1 = new long[loops][numObjs][numTextures];
+ final long[][][] t2 = new long[loops][numObjs][numTextures];
+ final long[][][] t3 = new long[loops][numObjs][numTextures];
+ final long[][] tF = new long[loops][numObjs];
+ final long[][] tS = new long[loops][numObjs];
for(int i=0; i<loops; i++) {
for(int j=0; j<numObjs; j++) {
tC[i][j] = System.currentTimeMillis();
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
t0[i][j] = System.currentTimeMillis();
@@ -140,7 +142,7 @@ public class PerfTextLoad extends PerfModule {
t2[i][j][k] = System.currentTimeMillis();
- gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, vertices.getElementCount());
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, vertices.getElemCount());
t3[i][j][k] = System.currentTimeMillis();
}
@@ -217,12 +219,12 @@ public class PerfTextLoad extends PerfModule {
System.gc();
try {
Thread.sleep(100);
- } catch (Exception e) {}
+ } catch (final Exception e) {}
System.gc();
}
@Override
- public void run(GLAutoDrawable drawable, int loops) {
+ public void run(final GLAutoDrawable drawable, final int loops) {
runOneSet(drawable, "bob2.64x64", 33, 1, loops);
runOneSet(drawable, "bob2.128x128", 33, 1, loops);
runOneSet(drawable, "bob2.128x128", 4, 1, loops);
diff --git a/src/demos/es2/perftst/PerfUniLoad.java b/src/demos/es2/perftst/PerfUniLoad.java
index ae5e98a..94849a3 100755
--- a/src/demos/es2/perftst/PerfUniLoad.java
+++ b/src/demos/es2/perftst/PerfUniLoad.java
@@ -13,18 +13,19 @@ public class PerfUniLoad extends PerfModule {
GLUniformData[] dummyA, dummyB, dummyC;
final int dataType=GL.GL_FLOAT;
-
+
public PerfUniLoad() {
}
- public ShaderState initShaderState(GL2ES2 gl) {
+ @Override
+ public ShaderState initShaderState(final GL2ES2 gl) {
return initShaderState(gl, "uni-vert-col", "fcolor");
}
- protected void runOneSet(GLAutoDrawable drawable, int numObjs, int numArrayElem, int loops) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ protected void runOneSet(final GLAutoDrawable drawable, final int numObjs, final int numArrayElem, final int loops) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
- //
+ //
// Vertices Data setup
//
@@ -38,9 +39,9 @@ public class PerfUniLoad extends PerfModule {
st.useProgram(gl, true);
- GLArrayDataServer vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ final GLArrayDataServer vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
- FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
+ final FloatBuffer vb = (FloatBuffer)vertices.getBuffer();
vb.put(0f); vb.put(0f); vb.put(0f);
vb.put(1f); vb.put(0f); vb.put(0f);
vb.put(0f); vb.put(1f); vb.put(0f);
@@ -48,9 +49,9 @@ public class PerfUniLoad extends PerfModule {
}
vertices.seal(gl, true);
- GLArrayDataServer colors = GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ final GLArrayDataServer colors = GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
{
- FloatBuffer cb = (FloatBuffer)colors.getBuffer();
+ final FloatBuffer cb = (FloatBuffer)colors.getBuffer();
cb.put(0f); cb.put(0f); cb.put(0f); cb.put(1f);
cb.put(1f); cb.put(0f); cb.put(0f); cb.put(1f);
cb.put(0f); cb.put(1f); cb.put(0f); cb.put(1f);
@@ -62,12 +63,13 @@ public class PerfUniLoad extends PerfModule {
// Uniform Data setup
//
- GLUniformData[] dummyUni = new GLUniformData[numObjs];
+ final GLUniformData[] dummyUni = new GLUniformData[numObjs];
- float x=0f, y=0f, z=0f, w=0f;
+ float x=0f, y=0f, z=0f;
+ final float w=0f;
for(int i=0; i<numObjs; i++) {
- FloatBuffer fb = Buffers.newDirectFloatBuffer(4*numArrayElem);
+ final FloatBuffer fb = Buffers.newDirectFloatBuffer(4*numArrayElem);
for(int j=0; j<numArrayElem; j++) {
// Fill them up
@@ -84,22 +86,24 @@ public class PerfUniLoad extends PerfModule {
dummyUni[i] = new GLUniformData("mgl_Dummy"+i, 4, fb);
}
- //
+ //
// run loops
//
- long dtC, dt, dt2, dt3, dtF, dtS, dtT;
- long[] tC = new long[loops];
- long[] t0 = new long[loops];
- long[][] t1 = new long[loops][numObjs];
- long[][] t2 = new long[loops][numObjs];
- long[] tF = new long[loops];
- long[] tS = new long[loops];
+ long dtC, dt;
+ final long dt2, dt3;
+ long dtF, dtS, dtT;
+ final long[] tC = new long[loops];
+ final long[] t0 = new long[loops];
+ final long[][] t1 = new long[loops][numObjs];
+ final long[][] t2 = new long[loops][numObjs];
+ final long[] tF = new long[loops];
+ final long[] tS = new long[loops];
for(int i=0; i<loops; i++) {
tC[i] = System.currentTimeMillis();
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
t0[i] = System.currentTimeMillis();
@@ -108,7 +112,7 @@ public class PerfUniLoad extends PerfModule {
t1[i][j] = System.currentTimeMillis();
- gl.glDrawArrays(GL.GL_LINE_STRIP, 0, vertices.getElementCount());
+ gl.glDrawArrays(GL.GL_LINE_STRIP, 0, vertices.getElemCount());
t2[i][j] = System.currentTimeMillis();
}
@@ -122,8 +126,8 @@ public class PerfUniLoad extends PerfModule {
tS[i] = System.currentTimeMillis();
}
- int uniElements = numObjs * numArrayElem ;
- int uniBytes = uniElements * Buffers.SIZEOF_FLOAT;
+ final int uniElements = numObjs * numArrayElem ;
+ final int uniBytes = uniElements * Buffers.SIZEOF_FLOAT;
dt = 0;
for(int i=1; i<loops; i++) {
@@ -136,7 +140,7 @@ public class PerfUniLoad extends PerfModule {
",\n total elements "+uniElements+
", total bytes "+uniBytes+", total time: "+dt +
"ms, fps(-1): "+(((loops-1)*1000)/dt)+
- ",\n uni elem/s: " + ((double)(loops*uniElements)/((double)dt/1000.0)));
+ ",\n uni elem/s: " + (loops*uniElements/(dt/1000.0)));
for(int i=0; i<loops; i++) {
dtC= t0[i] - tC[i];
@@ -160,10 +164,11 @@ public class PerfUniLoad extends PerfModule {
try {
Thread.sleep(100);
- } catch (Exception e) {}
+ } catch (final Exception e) {}
}
- public void run(GLAutoDrawable drawable, int loops) {
+ @Override
+ public void run(final GLAutoDrawable drawable, final int loops) {
runOneSet(drawable, 1, 1, loops);
runOneSet(drawable, 4, 1, loops);
diff --git a/src/demos/es2/perftst/PerfVBOLoad.java b/src/demos/es2/perftst/PerfVBOLoad.java
index 325b9a6..44dc81b 100755
--- a/src/demos/es2/perftst/PerfVBOLoad.java
+++ b/src/demos/es2/perftst/PerfVBOLoad.java
@@ -11,14 +11,15 @@ public class PerfVBOLoad extends PerfModule {
public PerfVBOLoad() {
}
- public ShaderState initShaderState(GL2ES2 gl) {
+ @Override
+ public ShaderState initShaderState(final GL2ES2 gl) {
return initShaderState(gl, "vbo-vert-col", "fcolor");
}
- protected void runOneSet(GLAutoDrawable drawable, int dataType, int numObjs, int numVertices, int loops, boolean useVBO) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ protected void runOneSet(final GLAutoDrawable drawable, final int dataType, final int numObjs, final int numVertices, final int loops, final boolean useVBO) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
- //
+ //
// data setup
//
@@ -32,7 +33,7 @@ public class PerfVBOLoad extends PerfModule {
vertices[i] = GLArrayDataServer.createGLSL("mgl_Vertex", 3, dataType, true, numVertices, GL.GL_STATIC_DRAW);
vertices[i].setVBOEnabled(useVBO);
{
- Buffer verticeb = vertices[i].getBuffer();
+ final Buffer verticeb = vertices[i].getBuffer();
for(int j=0; j<numVertices; j++) {
// Fill them up
put(verticeb, dataType, x);
@@ -47,7 +48,7 @@ public class PerfVBOLoad extends PerfModule {
colors[i].setVBOEnabled(useVBO);
{
// Fill them up
- Buffer colorb = colors[i].getBuffer();
+ final Buffer colorb = colors[i].getBuffer();
for(int j =0; j<numVertices; j++) {
put(colorb, dataType, r);
put(colorb, dataType, g);
@@ -56,31 +57,33 @@ public class PerfVBOLoad extends PerfModule {
if(r<=1f) r+=0.01f;
else if(g<=1f) g+=0.01f;
else if(b<=1f) b+=0.01f;
- else { r=0f; g=0f; b=0f; }
+ else { r=0f; g=0f; b=0f; }
}
}
}
- //
+ //
// run loops
//
- long dtC, dt, dt2, dt3, dtF, dtS, dtT;
- long[] tC = new long[loops];
- long[] t0 = new long[loops];
- long[][] t1 = new long[loops][numObjs];
- long[][] t2 = new long[loops][numObjs];
- long[][] t3 = new long[loops][numObjs];
- long[] tF = new long[loops];
- long[] tS = new long[loops];
-
- // Push the 1st uniform down the path
+ long dtC, dt;
+ final long dt2, dt3;
+ long dtF, dtS, dtT;
+ final long[] tC = new long[loops];
+ final long[] t0 = new long[loops];
+ final long[][] t1 = new long[loops][numObjs];
+ final long[][] t2 = new long[loops][numObjs];
+ final long[][] t3 = new long[loops][numObjs];
+ final long[] tF = new long[loops];
+ final long[] tS = new long[loops];
+
+ // Push the 1st uniform down the path
st.useProgram(gl, true);
for(int i=0; i<loops; i++) {
tC[i] = System.currentTimeMillis();
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
t0[i] = System.currentTimeMillis();
@@ -89,7 +92,7 @@ public class PerfVBOLoad extends PerfModule {
vertices[j].seal(gl, true);
} else if(numObjs>1) {
// we need to re-enable the buffer,
- // incl. the vertex attribute refresh
+ // incl. the vertex attribute refresh
// in case we switch to another buffer
vertices[j].enableBuffer(gl, true);
}
@@ -104,7 +107,7 @@ public class PerfVBOLoad extends PerfModule {
t2[i][j] = System.currentTimeMillis();
- gl.glDrawArrays(GL.GL_LINE_STRIP, 0, vertices[j].getElementCount());
+ gl.glDrawArrays(GL.GL_LINE_STRIP, 0, vertices[j].getElemCount());
if(numObjs>1) {
vertices[j].enableBuffer(gl, false);
@@ -128,10 +131,10 @@ public class PerfVBOLoad extends PerfModule {
colors[0].enableBuffer(gl, false);
}
- int verticesElements = vertices[0].getElementCount() * numObjs;
- int verticesBytes = verticesElements * vertices[0].getComponentSizeInBytes()* vertices[0].getComponentCount();
- int colorsElements = colors[0].getElementCount() * colors.length;
- int colorsBytes = colorsElements * colors[0].getComponentSizeInBytes()* colors[0].getComponentCount();
+ final int verticesElements = vertices[0].getElemCount() * numObjs;
+ final int verticesBytes = verticesElements * vertices[0].getBytesPerComp()* vertices[0].getCompsPerElem();
+ final int colorsElements = colors[0].getElemCount() * colors.length;
+ final int colorsBytes = colorsElements * colors[0].getBytesPerComp()* colors[0].getCompsPerElem();
dt = 0;
for(int i=1; i<loops; i++) {
@@ -140,12 +143,12 @@ public class PerfVBOLoad extends PerfModule {
System.out.println("");
System.out.println("Loops "+loops+", useVBO "+useVBO+", objects "+numObjs+", type "+getTypeName(dataType)+
- ", vertices p.o. "+vertices[0].getElementCount()+
- ", colors p.o. "+colors[0].getElementCount()+
+ ", vertices p.o. "+vertices[0].getElemCount()+
+ ", colors p.o. "+colors[0].getElemCount()+
",\n total elements "+(verticesElements+colorsElements)+
", total bytes "+(verticesBytes+colorsBytes)+", total time: "+dt +
"ms, fps(-1): "+(((loops-1)*1000)/dt)+
- ",\n col.vert./s: " + ((double)(loops*verticesElements)/((double)dt/1000.0)));
+ ",\n col.vert./s: " + (loops*verticesElements/(dt/1000.0)));
for(int i=0; i<loops; i++) {
dtC= t0[i] - tC[i];
@@ -179,10 +182,10 @@ public class PerfVBOLoad extends PerfModule {
try {
Thread.sleep(100);
- } catch (Exception e) {}
+ } catch (final Exception e) {}
}
- protected void runOneSet(GLAutoDrawable drawable, int numObjs, int numVertices, int loops) {
+ protected void runOneSet(final GLAutoDrawable drawable, final int numObjs, final int numVertices, final int loops) {
runOneSet(drawable, GL.GL_UNSIGNED_BYTE, numObjs, numVertices, loops, true);
runOneSet(drawable, GL.GL_UNSIGNED_BYTE, numObjs, numVertices, loops, false);
runOneSet(drawable, GL.GL_BYTE, numObjs, numVertices, loops, true);
@@ -194,14 +197,15 @@ public class PerfVBOLoad extends PerfModule {
runOneSet(drawable, GL.GL_FLOAT, numObjs, numVertices, loops, true);
runOneSet(drawable, GL.GL_FLOAT, numObjs, numVertices, loops, false);
- GL2ES2 gl = drawable.getGL().getGL2ES2();
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
if(gl.isGLES2()) {
runOneSet(drawable, GL.GL_FIXED, numObjs, numVertices, loops, true);
runOneSet(drawable, GL.GL_FIXED, numObjs, numVertices, loops, false);
}
}
- public void run(GLAutoDrawable drawable, int loops) {
+ @Override
+ public void run(final GLAutoDrawable drawable, final int loops) {
runOneSet(drawable, 1, 100, loops);
runOneSet(drawable, 3, 100, loops);
diff --git a/src/demos/readbuffer/ReadBuffer2Screen.java b/src/demos/readbuffer/ReadBuffer2Screen.java
index d304599..bb6200f 100755
--- a/src/demos/readbuffer/ReadBuffer2Screen.java
+++ b/src/demos/readbuffer/ReadBuffer2Screen.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
*/
package demos.readbuffer;
@@ -38,8 +38,6 @@ import com.jogamp.opengl.*;
import com.jogamp.opengl.fixedfunc.*;
import com.jogamp.opengl.util.*;
-
-import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.texture.TextureCoords;
import com.jogamp.opengl.util.GLArrayDataClient;
import com.jogamp.opengl.util.GLArrayDataServer;
@@ -51,18 +49,19 @@ public class ReadBuffer2Screen extends ReadBufferBase {
boolean enableBufferAlways = false; // FIXME
boolean enableBufferVBO = true; // FIXME
- public ReadBuffer2Screen (GLDrawable externalRead) {
+ public ReadBuffer2Screen (final GLDrawable externalRead) {
super(externalRead);
}
- public void init(GLAutoDrawable drawable) {
+ @Override
+ public void init(final GLAutoDrawable drawable) {
super.init(drawable);
- GL gl = drawable.getGL();
+ final GL gl = drawable.getGL();
pmvMatrix = new PMVMatrix();
- float f_edge = 1f;
+ final float f_edge = 1f;
if(null==readTextureVertices) {
//readTextureVertices = GLArrayDataClient.createFixed(gl, GLPointerFunc.GL_VERTEX_ARRAY,
// 2, GL.GL_FLOAT, true, 4);
@@ -71,7 +70,7 @@ public class ReadBuffer2Screen extends ReadBufferBase {
readTextureVertices.setEnableAlways(enableBufferAlways);
readTextureVertices.setVBOEnabled(enableBufferVBO);
{
- FloatBuffer vb = (FloatBuffer)readTextureVertices.getBuffer();
+ final FloatBuffer vb = (FloatBuffer)readTextureVertices.getBuffer();
vb.put(-f_edge); vb.put(-f_edge);
vb.put( f_edge); vb.put(-f_edge);
vb.put(-f_edge); vb.put( f_edge);
@@ -85,10 +84,11 @@ public class ReadBuffer2Screen extends ReadBufferBase {
gl.glClearColor(0.5f, 0.5f, 0.5f, 0.4f);
}
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ @Override
+ public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
super.reshape(drawable, x, y, width, height);
- GL gl = drawable.getGL();
+ final GL gl = drawable.getGL();
gl.glViewport(0, 0, width, height);
@@ -104,29 +104,30 @@ public class ReadBuffer2Screen extends ReadBufferBase {
}
// Identity ..
- pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -2.5f);
if(null!=glM) {
- glM.glMatrixMode(pmvMatrix.GL_MODELVIEW);
+ glM.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
glM.glLoadMatrixf(pmvMatrix.glGetMvMatrixf());
}
// Set location in front of camera
- pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
if(null!=glM) {
- glM.glMatrixMode(pmvMatrix.GL_PROJECTION);
+ glM.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
glM.glLoadMatrixf(pmvMatrix.glGetPMatrixf());
}
}
- public void dispose(GLAutoDrawable drawable) {
+ @Override
+ public void dispose(final GLAutoDrawable drawable) {
super.dispose(drawable);
}
- void renderOffscreenTexture(GL gl) {
+ void renderOffscreenTexture(final GL gl) {
if(!readBufferUtil.isValid()) return;
// Now draw one quad with the texture
@@ -144,7 +145,7 @@ public class ReadBuffer2Screen extends ReadBufferBase {
if(null!=readTextureCoords) {
readTextureCoords.enableBuffer(gl, true);
}
- gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, readTextureVertices.getElementCount());
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, readTextureVertices.getElemCount());
/**
if(null!=readTextureCoords) {
readTextureCoords.enableBuffer(gl, false);
@@ -154,15 +155,15 @@ public class ReadBuffer2Screen extends ReadBufferBase {
readBufferUtil.getTexture().disable(gl);
}
- void updateTextureCoords(GL gl, boolean force) {
+ void updateTextureCoords(final GL gl, final boolean force) {
if(force || null==readTextureCoords) {
readTextureCoords = GLArrayDataServer.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY,
2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
readTextureCoords.setEnableAlways(enableBufferAlways);
readTextureCoords.setVBOEnabled(enableBufferVBO);
{
- TextureCoords coords = readBufferUtil.getTexture().getImageTexCoords();
- FloatBuffer cb = (FloatBuffer)readTextureCoords.getBuffer();
+ final TextureCoords coords = readBufferUtil.getTexture().getImageTexCoords();
+ final FloatBuffer cb = (FloatBuffer)readTextureCoords.getBuffer();
cb.put(coords.left()); cb.put(coords.bottom());
cb.put(coords.right()); cb.put(coords.bottom());
cb.put(coords.left()); cb.put(coords.top());
@@ -173,12 +174,13 @@ public class ReadBuffer2Screen extends ReadBufferBase {
}
}
- public void display(GLAutoDrawable drawable) {
+ @Override
+ public void display(final GLAutoDrawable drawable) {
super.display(drawable);
- GL gl = drawable.getGL();
+ final GL gl = drawable.getGL();
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
if(gl instanceof GLLightingFunc) {
((GLLightingFunc)gl).glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}