aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-17 12:49:52 +0200
committerSven Gothel <[email protected]>2011-05-17 12:49:52 +0200
commitd2d47b1ab22bdc54ff35c1466934138bcb6906b4 (patch)
tree82f2fd4ad159b0f9d5e9b99d0574971474f15f96
parenta0777144c46d12d148556ed64ad0a9b9d6d24c0c (diff)
GLSL UnitTest: Reloc Ruler and make local fields final
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java (renamed from src/test/com/jogamp/opengl/test/junit/graph/TestRulerNEWT01.java)48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRulerNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
index a8b6fab20..365596711 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestRulerNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
@@ -25,7 +25,7 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-package com.jogamp.opengl.test.junit.graph;
+package com.jogamp.opengl.test.junit.jogl.glsl;
import com.jogamp.common.nio.Buffers;
import com.jogamp.newt.util.MonitorMode;
@@ -58,40 +58,40 @@ public class TestRulerNEWT01 extends UITestCase {
@Test
public void test01() throws InterruptedException {
// preset ..
- NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 640, 480, true);
- GLDrawable drawable = winctx.context.getGLDrawable();
- GL2ES2 gl = winctx.context.getGL().getGL2ES2();
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createWindow(GLProfile.getGL2ES2(), 640, 480, true);
+ final GLDrawable drawable = winctx.context.getGLDrawable();
+ final GL2ES2 gl = winctx.context.getGL().getGL2ES2();
System.err.println(winctx.context);
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// test code ..
- ShaderState st = new ShaderState();
+ final ShaderState st = new ShaderState();
- ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, RedSquare0.class,
+ final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, RedSquare0.class,
"shader", "shader/bin", "default");
- ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, RedSquare0.class,
+ final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, RedSquare0.class,
"shader", "shader/bin", "ruler");
- ShaderProgram sp = new ShaderProgram();
- sp.add(gl, rsVp, System.err);
- sp.add(gl, rsFp, System.err);
- Assert.assertTrue(0<=sp.program());
- Assert.assertTrue(!sp.inUse());
- Assert.assertTrue(!sp.linked());
+ final ShaderProgram sp0 = new ShaderProgram();
+ sp0.add(gl, vp0, System.err);
+ sp0.add(gl, fp0, System.err);
+ Assert.assertTrue(0<=sp0.program());
+ Assert.assertTrue(!sp0.inUse());
+ Assert.assertTrue(!sp0.linked());
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
- st.attachShaderProgram(gl, sp);
+ st.attachShaderProgram(gl, sp0);
st.useProgram(gl, true);
- PMVMatrix pmvMatrix = new PMVMatrix();
- GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
+ final PMVMatrix pmvMatrix = new PMVMatrix();
+ final GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
st.ownUniform(pmvMatrixUniform);
st.uniform(gl, pmvMatrixUniform);
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
- GLUniformData rulerColor= new GLUniformData("gcu_RulerColor", 3, Buffers.newDirectFloatBuffer(3));
- FloatBuffer rulerColorV = (FloatBuffer) rulerColor.getBuffer();
+ final GLUniformData rulerColor= new GLUniformData("gcu_RulerColor", 3, Buffers.newDirectFloatBuffer(3));
+ final FloatBuffer rulerColorV = (FloatBuffer) rulerColor.getBuffer();
rulerColorV.put(0, 0.5f);
rulerColorV.put(1, 0.5f);
rulerColorV.put(2, 0.5f);
@@ -99,11 +99,11 @@ public class TestRulerNEWT01 extends UITestCase {
st.uniform(gl, rulerColor);
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
- MonitorMode mmode = winctx.window.getScreen().getCurrentScreenMode().getMonitorMode();
- DimensionReadOnly sdim = mmode.getScreenSizeMM();
- DimensionReadOnly spix = mmode.getSurfaceSize().getResolution();
- GLUniformData rulerPixFreq = new GLUniformData("gcu_RulerPixFreq", 2, Buffers.newDirectFloatBuffer(2));
- FloatBuffer rulerPixFreqV = (FloatBuffer) rulerPixFreq.getBuffer();
+ final MonitorMode mmode = winctx.window.getScreen().getCurrentScreenMode().getMonitorMode();
+ final DimensionReadOnly sdim = mmode.getScreenSizeMM();
+ final DimensionReadOnly spix = mmode.getSurfaceSize().getResolution();
+ final GLUniformData rulerPixFreq = new GLUniformData("gcu_RulerPixFreq", 2, Buffers.newDirectFloatBuffer(2));
+ final FloatBuffer rulerPixFreqV = (FloatBuffer) rulerPixFreq.getBuffer();
rulerPixFreqV.put(0, (float)spix.getWidth() / (float)sdim.getWidth() * 10.0f);
rulerPixFreqV.put(1, (float)spix.getHeight() / (float)sdim.getHeight() * 10.0f);
st.ownUniform(rulerPixFreq);
@@ -113,7 +113,7 @@ public class TestRulerNEWT01 extends UITestCase {
System.err.println("Screen siz "+spix);
System.err.println("Screen pixel/cm "+rulerPixFreqV.get(0)+", "+rulerPixFreqV.get(1));
- GLArrayDataServer vertices0 = GLArrayDataServer.createGLSL(st, "gca_Vertices", 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
+ final GLArrayDataServer vertices0 = GLArrayDataServer.createGLSL(st, "gca_Vertices", 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
vertices0.putf(0); vertices0.putf(1); vertices0.putf(0);
vertices0.putf(1); vertices0.putf(1); vertices0.putf(0);
vertices0.putf(0); vertices0.putf(0); vertices0.putf(0);