summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-25 15:38:35 +0200
committerSven Gothel <[email protected]>2011-04-25 15:38:35 +0200
commit41f73bf3bb8127dcfbbfb815bc7487007b47253c (patch)
treebf2b64480a3231aa2cfe166ce9429c24f8713784 /src/test
parent90bfd948586881b20704f33acbb74514d27faefe (diff)
Fix GLSL Shader tests ..
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java84
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java69
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java82
3 files changed, 146 insertions, 89 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java
index 0656b6338..ebe24cb00 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java
@@ -27,7 +27,10 @@
*/
package com.jogamp.opengl.test.junit.jogl.glsl;
-import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.Display;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.Screen;
+import com.jogamp.newt.Window;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.glsl.ShaderState;
@@ -35,6 +38,8 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLProfile;
import org.junit.Assert;
@@ -43,27 +48,62 @@ public class GLSLMiscHelper {
public static final int frames_perftest = 10000; // frames
public static final int frames_warmup = 500; // frames
- public static GLWindow createWindow() throws InterruptedException {
- GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
+ public static class WindowContext {
+ public final Window window;
+ public final GLContext context;
+
+ public WindowContext(Window w, GLContext c) {
+ window = w;
+ context = c;
+ }
+ }
+
+ public static WindowContext createWindow(GLProfile glp, boolean debugGL) {
GLCapabilities caps = new GLCapabilities(glp);
- GLWindow window = GLWindow.create(caps);
- window.setSize(800, 600);
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+
+ Window window = NewtFactory.createWindow(screen, caps);
+ Assert.assertNotNull(window);
+ window.setSize(480, 480);
window.setVisible(true);
- Assert.assertTrue(window.isNativeValid());
- Assert.assertTrue(window.isRealized());
- GLContext context = window.getContext();
+
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ GLDrawable drawable = factory.createGLDrawable(window);
+ Assert.assertNotNull(drawable);
+
+ drawable.setRealized(true);
+
+ GLContext context = drawable.createContext(null);
Assert.assertNotNull(context);
- context.setSynchronized(true);
- while(!context.isCreated()) {
- // wait for context creation via above setVisible
- Thread.sleep(100);
- }
- context.makeCurrent(); // native context creation
- context.release();
- Assert.assertTrue(context.isCreated());
- return window;
+
+ context.enableGLDebugMessage(debugGL);
+
+ int res = context.makeCurrent();
+ Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res);
+
+ return new WindowContext(window, context);
}
-
+
+ public static void destroyWindow(WindowContext winctx) {
+ GLDrawable drawable = winctx.context.getGLDrawable();
+
+ Assert.assertNotNull(winctx.context);
+ winctx.context.destroy();
+
+ Assert.assertNotNull(drawable);
+ drawable.setRealized(false);
+
+ Assert.assertNotNull(winctx.window);
+ winctx.window.destroy();
+ }
+
public static void validateGLArrayDataServerState(GL2ES2 gl, ShaderState st, GLArrayDataServer data) {
int[] qi = new int[1];
if(null != st) {
@@ -89,7 +129,7 @@ public class GLSLMiscHelper {
}
}
- public static void displayVCArrays(GLWindow window, GL2ES2 gl, ShaderState st, boolean preEnable, GLArrayDataServer vertices, GLArrayDataServer colors, boolean postDisable, int num, long postDelay) throws InterruptedException {
+ public static void displayVCArrays(GLDrawable drawable, GL2ES2 gl, ShaderState st, boolean preEnable, GLArrayDataServer vertices, GLArrayDataServer colors, boolean postDisable, int num, long postDelay) throws InterruptedException {
System.err.println("screen #"+num);
if(preEnable) {
vertices.enableBuffer(gl, true);
@@ -116,11 +156,11 @@ public class GLSLMiscHelper {
Assert.assertTrue(!colors.enabled());
}
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
- window.swapBuffers();
+ drawable.swapBuffers();
if(postDelay>0) { pause(postDelay); }
}
- public static void displayVCArraysNoChecks(GLWindow window, GL2ES2 gl, boolean preEnable, GLArrayDataServer vertices, GLArrayDataServer colors, boolean postDisable) throws InterruptedException {
+ public static void displayVCArraysNoChecks(GLDrawable drawable, GL2ES2 gl, boolean preEnable, GLArrayDataServer vertices, GLArrayDataServer colors, boolean postDisable) throws InterruptedException {
if(preEnable) {
vertices.enableBuffer(gl, true);
colors.enableBuffer(gl, true);
@@ -131,7 +171,7 @@ public class GLSLMiscHelper {
vertices.enableBuffer(gl, false);
colors.enableBuffer(gl, false);
}
- window.swapBuffers();
+ drawable.swapBuffers();
}
public static GLArrayDataServer createRSVertices0(GL2ES2 gl, ShaderState st, int location) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
index ea5680d42..f357113d3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
@@ -27,7 +27,6 @@
*/
package com.jogamp.opengl.test.junit.jogl.glsl;
-import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
@@ -40,7 +39,8 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import java.io.IOException;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.GLUniformData;
import org.junit.Assert;
@@ -59,10 +59,9 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
@Test
public void testShaderState01Validation() throws InterruptedException {
// preset ..
- GLWindow window = GLSLMiscHelper.createWindow();
- GLContext context = window.getContext();
- context.makeCurrent();
- GL2ES2 gl = context.getGL().getGL2ES2();
+ GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), true);
+ GLDrawable drawable = winctx.context.getGLDrawable();
+ GL2ES2 gl = winctx.context.getGL().getGL2ES2();
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
@@ -144,7 +143,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) window.getWidth() / (float) window.getHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
@@ -152,13 +151,13 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// display #1 vertices0 / colors0 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 1, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, durationPerTest);
// display #2 #1 vertices1 / colors1 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices1, colors1, true, 2, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 2, durationPerTest);
// display #3 vertices0 / colors0 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 3, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 3, durationPerTest);
// cleanup
vertices1.destroy(gl);
@@ -167,8 +166,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
colors1.destroy(gl);
st.glUseProgram(gl, false);
sp.release(gl, true);
- context.release();
- window.destroy();
+
+ GLSLMiscHelper.destroyWindow(winctx);
}
@Test
@@ -182,11 +181,10 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
void testShaderState00PerformanceSingle(boolean toggleEnable) throws InterruptedException {
// preset ..
- GLWindow window = GLSLMiscHelper.createWindow();
- GLContext context = window.getContext();
- context.makeCurrent();
- GL2ES2 gl = context.getGL().getGL2ES2();
-
+ GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), false);
+ GLDrawable drawable = winctx.context.getGLDrawable();
+ GL2ES2 gl = winctx.context.getGL().getGL2ES2();
+
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// test code ..
@@ -227,7 +225,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) window.getWidth() / (float) window.getHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
@@ -237,15 +235,15 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
int frames;
// validation ..
- GLSLMiscHelper.displayVCArrays(window, gl, st, toggleEnable, vertices0, colors0, toggleEnable, 1, 0);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, toggleEnable, vertices0, colors0, toggleEnable, 1, 0);
// warmup ..
for(frames=0; frames<GLSLMiscHelper.frames_warmup; frames++) {
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, toggleEnable, vertices0, colors0, toggleEnable);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, toggleEnable, vertices0, colors0, toggleEnable);
}
// measure ..
for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames++) {
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, toggleEnable, vertices0, colors0, toggleEnable);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, toggleEnable, vertices0, colors0, toggleEnable);
}
final long t1 = System.currentTimeMillis();
final long dt = t1 - t0;
@@ -259,17 +257,16 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
sp.release(gl, true);
vertices0.destroy(gl);
colors0.destroy(gl);
- context.release();
- window.destroy();
+
+ GLSLMiscHelper.destroyWindow(winctx);
}
@Test
public void testShaderState01PerformanceDouble() throws InterruptedException {
// preset ..
- GLWindow window = GLSLMiscHelper.createWindow();
- GLContext context = window.getContext();
- context.makeCurrent();
- GL2ES2 gl = context.getGL().getGL2ES2();
+ GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), false);
+ GLDrawable drawable = winctx.context.getGLDrawable();
+ GL2ES2 gl = winctx.context.getGL().getGL2ES2();
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
@@ -319,27 +316,27 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) window.getWidth() / (float) window.getHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
st.glUniform(gl, pmvMatrixUniform);
// validation ..
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 1, 0);
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices1, colors1, true, 2, 0);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, 0);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 2, 0);
long t0 = System.currentTimeMillis();
int frames;
// warmup ..
for(frames=0; frames<GLSLMiscHelper.frames_warmup; frames+=2) {
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true);
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true);
}
// measure ..
for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames+=2) {
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true);
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true);
}
final long t1 = System.currentTimeMillis();
final long dt = t1 - t0;
@@ -355,8 +352,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
vertices0.destroy(gl);
colors0.destroy(gl);
colors1.destroy(gl);
- context.release();
- window.destroy();
+
+ GLSLMiscHelper.destroyWindow(winctx);
}
public static void main(String args[]) throws IOException {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
index 7af31fdfd..10e506693 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
@@ -34,6 +34,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquare0;
+import com.jogamp.opengl.test.junit.jogl.glsl.GLSLMiscHelper.WindowContext;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -41,6 +42,8 @@ import java.io.IOException;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDrawable;
+import javax.media.opengl.GLProfile;
import javax.media.opengl.GLUniformData;
import org.junit.Assert;
@@ -59,11 +62,10 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
@Test
public void testShaderState01Validation() throws InterruptedException {
// preset ..
- GLWindow window = GLSLMiscHelper.createWindow();
- GLContext context = window.getContext();
- context.makeCurrent();
- GL2ES2 gl = context.getGL().getGL2ES2();
-
+ GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), true);
+ GLDrawable drawable = winctx.context.getGLDrawable();
+ GL2ES2 gl = winctx.context.getGL().getGL2ES2();
+
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// test code ..
@@ -161,7 +163,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) window.getWidth() / (float) window.getHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
@@ -169,29 +171,31 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// display #1 vertices0 / colors0 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 1, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, durationPerTest);
// display #2 #1 vertices1 / colors1 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices1, colors1, true, 2, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 2, durationPerTest);
// display #3 vertices0 / colors0 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 3, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 3, durationPerTest);
// SP1
// both are currently not attached to ShaderState, hence we have to reset their location as well
vertices0.setLocation(-1);
colors0.setLocation(-1);
+ vertices1.setLocation(-1);
+ colors1.setLocation(-1);
st.attachShaderProgram(gl, sp1);
// display #1 vertices0 / colors0 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 10, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 10, durationPerTest);
// display #2 #1 vertices1 / colors1 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices1, colors1, true, 20, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 20, durationPerTest);
// display #3 vertices0 / colors0 (post-disable)
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 30, durationPerTest);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 30, durationPerTest);
// cleanup
vertices1.destroy(gl);
@@ -200,18 +204,17 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
colors1.destroy(gl);
st.glUseProgram(gl, false);
sp0.release(gl, true);
- context.release();
- window.destroy();
+
+ GLSLMiscHelper.destroyWindow(winctx);
}
@Test
public void testShaderState01PerformanceDouble() throws InterruptedException {
// preset ..
- GLWindow window = GLSLMiscHelper.createWindow();
- GLContext context = window.getContext();
- context.makeCurrent();
- GL2ES2 gl = context.getGL().getGL2ES2();
-
+ GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), false);
+ GLDrawable drawable = winctx.context.getGLDrawable();
+ GL2ES2 gl = winctx.context.getGL().getGL2ES2();
+
Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// test code ..
@@ -270,37 +273,54 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) window.getWidth() / (float) window.getHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
st.glUniform(gl, pmvMatrixUniform);
// validation ..
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices0, colors0, true, 1, 0);
- GLSLMiscHelper.displayVCArrays(window, gl, st, true, vertices1, colors1, true, 2, 0);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, 0);
+ GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 2, 0);
long t0 = System.currentTimeMillis();
int frames;
// warmup ..
for(frames=0; frames<GLSLMiscHelper.frames_warmup; frames+=2) {
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true);
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true);
+ // SP0
+ vertices0.setLocation(-1);
+ colors0.setLocation(-1);
+ vertices1.setLocation(-1);
+ colors1.setLocation(-1);
+ st.attachShaderProgram(gl, sp0);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true);
+ // SP1
+ vertices0.setLocation(-1);
+ colors0.setLocation(-1);
+ vertices1.setLocation(-1);
+ colors1.setLocation(-1);
+ st.attachShaderProgram(gl, sp1);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true);
}
// measure ..
for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames+=4) {
// SP0
vertices0.setLocation(-1);
colors0.setLocation(-1);
+ vertices1.setLocation(-1);
+ colors1.setLocation(-1);
st.attachShaderProgram(gl, sp0);
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true);
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true);
+
// SP1
vertices0.setLocation(-1);
- colors0.setLocation(-1);
+ colors0.setLocation(-1);
+ vertices1.setLocation(-1);
+ colors1.setLocation(-1);
st.attachShaderProgram(gl, sp1);
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices0, colors0, true);
- GLSLMiscHelper.displayVCArraysNoChecks(window, gl, true, vertices1, colors1, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true);
+ GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true);
}
final long t1 = System.currentTimeMillis();
@@ -317,8 +337,8 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
vertices0.destroy(gl);
colors0.destroy(gl);
colors1.destroy(gl);
- context.release();
- window.destroy();
+
+ GLSLMiscHelper.destroyWindow(winctx);
}
public static void main(String args[]) throws IOException {