aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-05-17 04:52:32 +0200
committerSven Gothel <[email protected]>2013-05-17 04:52:32 +0200
commit33abeb8097a8f80acd1a4ce94b4866e5dc41f0c0 (patch)
tree263bfc8987a159bec0f4d1cfec2427f6a5660189 /src/test/com/jogamp/opengl
parent31e72d2f2d953352b2a8c83368039ecca8139d49 (diff)
Fix Bug 737: Add shader default precision for GLSL [1.30 .. 1.50[ - See GLSL Spec [1.30 - 1.40].
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java26
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java116
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java4
11 files changed, 162 insertions, 36 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index f21e767fa..66a8082a6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -148,8 +148,8 @@ public class GearsES2 implements GLEventListener {
"shader/bin", "gears", true);
final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader",
"shader/bin", "gears", true);
- vp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- fp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ vp0.defaultShaderCustomization(gl, true, true);
+ fp0.defaultShaderCustomization(gl, true, true);
final ShaderProgram sp0 = new ShaderProgram();
sp0.add(gl, vp0, System.err);
sp0.add(gl, fp0, System.err);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
index 43b919e78..52af4916c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
@@ -94,8 +94,8 @@ public class PointsDemoES2 extends PointsDemo {
"shader/bin", "PointsShader", true);
final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader",
"shader/bin", "PointsShader", true);
- vp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- fp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ vp0.defaultShaderCustomization(gl, true, true);
+ fp0.defaultShaderCustomization(gl, true, true);
final ShaderProgram sp0 = new ShaderProgram();
sp0.add(gl, vp0, System.err);
sp0.add(gl, fp0, System.err);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
index 688653471..3f092e341 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
@@ -84,8 +84,8 @@ public class RedSquareES2 implements GLEventListener {
"shader/bin", "RedSquareShader", true);
final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader",
"shader/bin", "RedSquareShader", true);
- vp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- fp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ vp0.defaultShaderCustomization(gl, true, true);
+ fp0.defaultShaderCustomization(gl, true, true);
final ShaderProgram sp0 = new ShaderProgram();
sp0.add(gl, vp0, System.err);
sp0.add(gl, fp0, System.err);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java
index 4bcb073dc..622df8695 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java
@@ -70,8 +70,8 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
"shader", "shader/bin", shaderBasename, true);
ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
- rsVp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- rsFp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ rsVp.defaultShaderCustomization(gl, true, true);
+ rsFp.defaultShaderCustomization(gl, true, true);
// Create & Link the shader program
ShaderProgram sp = new ShaderProgram();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
index a51df5088..a63f2590a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
@@ -75,6 +75,7 @@ public class TestGearsES2AWT extends UITestCase {
static boolean forceES2 = false;
static boolean forceGL3 = false;
+ static boolean mainRun = false;
static boolean shallUseOffscreenFBOLayer = false;
static boolean shallUseOffscreenPBufferLayer = false;
static boolean useMSAA = false;
@@ -310,10 +311,35 @@ public class TestGearsES2AWT extends UITestCase {
runTestGL(caps, resizeBy, frameLayout);
}
+ @Test
+ public void test02_GLES2() throws InterruptedException, InvocationTargetException {
+ if(mainRun) return;
+
+ if( !GLProfile.isAvailable(GLProfile.GLES2) ) {
+ System.err.println("GLES2 n/a");
+ }
+ final GLProfile glp = GLProfile.get(GLProfile.GLES2);
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps, resizeBy, frameLayout);
+ }
+
+ @Test
+ public void test03_GL3() throws InterruptedException, InvocationTargetException {
+ if(mainRun) return;
+
+ if( !GLProfile.isAvailable(GLProfile.GL3) ) {
+ System.err.println("GL3 n/a");
+ }
+ final GLProfile glp = GLProfile.get(GLProfile.GL3);
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps, resizeBy, frameLayout);
+ }
+
public static void main(String args[]) {
boolean waitForKey = false;
int rw=-1, rh=-1;
+ mainRun = true;
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
index bbb9fde1b..c7354c335 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
@@ -41,6 +41,7 @@ import javax.swing.SwingUtilities;
import org.junit.AfterClass;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -55,8 +56,9 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.FPSAnimator;
public class TestGearsES2GLJPanelAWT extends UITestCase {
- static GLProfile glp;
- static int width, height;
+ static Dimension wsize, rwsize=null;
+ static boolean forceES2 = false;
+ static boolean forceGL3 = false;
static boolean shallUsePBuffer = false;
static boolean shallUseBitmap = false;
static boolean useMSAA = false;
@@ -66,13 +68,8 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
@BeforeClass
public static void initClass() {
- if(GLProfile.isAvailable(GLProfile.GL2)) {
- glp = GLProfile.get(GLProfile.GL2);
- Assert.assertNotNull(glp);
- width = 640;
- height = 480;
- } else {
- setTestSupported(false);
+ if(null == wsize) {
+ wsize = new Dimension(640, 480);
}
}
@@ -80,6 +77,21 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
public static void releaseClass() {
}
+ static void setFrameSize(final JFrame frame, final boolean frameLayout, final java.awt.Dimension new_sz) {
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setSize(new_sz);
+ if( frameLayout ) {
+ frame.validate();
+ }
+ } } );
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ }
+
protected void runTestGL(GLCapabilities caps)
throws AWTException, InterruptedException, InvocationTargetException
{
@@ -88,10 +100,9 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
final GLJPanel glJPanel = new GLJPanel(caps);
Assert.assertNotNull(glJPanel);
- Dimension glc_sz = new Dimension(width, height);
- glJPanel.setMinimumSize(glc_sz);
- glJPanel.setPreferredSize(glc_sz);
- glJPanel.setSize(glc_sz);
+ glJPanel.setMinimumSize(wsize);
+ glJPanel.setPreferredSize(wsize);
+ glJPanel.setSize(wsize);
glJPanel.addGLEventListener(new GearsES2(swapInterval));
final SnapshotGLEventListener snap = new SnapshotGLEventListener();
glJPanel.addGLEventListener(snap);
@@ -117,6 +128,16 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel);
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ snap.setMakeSnapshot();
+
+ if( null != rwsize ) {
+ Thread.sleep(500); // 500ms delay
+ setFrameSize(frame, true, rwsize);
+ System.err.println("window resize pos/siz: "+glJPanel.getX()+"/"+glJPanel.getY()+" "+glJPanel.getWidth()+"x"+glJPanel.getHeight());
+ }
+
+ snap.setMakeSnapshot();
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
boolean triggerSnap = false;
@@ -153,7 +174,15 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
public void test01_DefaultNorm()
throws AWTException, InterruptedException, InvocationTargetException
{
- GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ final GLProfile glp;
+ if(forceGL3) {
+ glp = GLProfile.get(GLProfile.GL3);
+ } else if(forceES2) {
+ glp = GLProfile.get(GLProfile.GLES2);
+ } else {
+ glp = GLProfile.getGL2ES2();
+ }
+ GLCapabilities caps = new GLCapabilities( glp );
if(useMSAA) {
caps.setNumSamples(4);
caps.setSampleBuffers(true);
@@ -232,13 +261,63 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
runTestGL(caps);
}
+ @Test
+ public void test20_GLES2()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( manualTest ) {
+ return;
+ }
+
+ if( !GLProfile.isAvailable(GLProfile.GLES2) ) {
+ System.err.println("GLES2 n/a");
+ }
+ final GLProfile glp = GLProfile.get(GLProfile.GLES2);
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps);
+ }
+
+ @Test
+ public void test30_GL3()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( manualTest ) {
+ return;
+ }
+
+ if( !GLProfile.isAvailable(GLProfile.GL3) ) {
+ System.err.println("GL3 n/a");
+ }
+ final GLProfile glp = GLProfile.get(GLProfile.GL3);
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps);
+ }
+
static long duration = 500; // ms
public static void main(String args[]) {
+ int w=640, h=480, rw=-1, rh=-1;
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-es2")) {
+ forceES2 = true;
+ } else if(args[i].equals("-gl3")) {
+ forceGL3 = true;
+ } else if(args[i].equals("-width")) {
+ i++;
+ w = MiscUtils.atoi(args[i], w);
+ } else if(args[i].equals("-height")) {
+ i++;
+ h = MiscUtils.atoi(args[i], h);
+ } else if(args[i].equals("-rwidth")) {
+ i++;
+ rw = MiscUtils.atoi(args[i], rw);
+ } else if(args[i].equals("-rheight")) {
+ i++;
+ rh = MiscUtils.atoi(args[i], rh);
} else if(args[i].equals("-vsync")) {
i++;
swapInterval = MiscUtils.atoi(args[i], swapInterval);
@@ -254,7 +333,16 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
manualTest = true;
}
}
+ wsize = new Dimension(w, h);
+ if( 0 < rw && 0 < rh ) {
+ rwsize = new Dimension(rw, rh);
+ }
+
+ System.err.println("size "+wsize);
+ System.err.println("resize "+rwsize);
System.err.println("swapInterval "+swapInterval);
+ System.err.println("forceES2 "+forceES2);
+ System.err.println("forceGL3 "+forceGL3);
System.err.println("useMSAA "+useMSAA);
System.err.println("useAnimator "+useAnimator);
System.err.println("shallUsePBuffer "+shallUsePBuffer);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index d195d6b18..f4b4e1397 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -310,7 +310,7 @@ public class TestGearsES2NEWT extends UITestCase {
}
@Test
- public void test01GL2ES2() throws InterruptedException {
+ public void test01_GL2ES2() throws InterruptedException {
for(int i=1; i<=loops; i++) {
System.err.println("Loop "+i+"/"+loops);
final GLProfile glp;
@@ -334,7 +334,19 @@ public class TestGearsES2NEWT extends UITestCase {
}
@Test
- public void test02GL3() throws InterruptedException {
+ public void test02_GLES2() throws InterruptedException {
+ if(mainRun) return;
+
+ if( !GLProfile.isAvailable(GLProfile.GLES2) ) {
+ System.err.println("GLES2 n/a");
+ }
+ final GLProfile glp = GLProfile.get(GLProfile.GLES2);
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps, undecorated);
+ }
+
+ @Test
+ public void test03_GL3() throws InterruptedException {
if(mainRun) return;
if( !GLProfile.isAvailable(GLProfile.GL3) ) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
index c6f4ee0c0..e69286311 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
@@ -112,9 +112,9 @@ public class GeomShader01TextureGL3 implements GLEventListener {
"shader", "shader/bin", geomShaderBaseNames[geomShader], true);
fs = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
- vs.defaultShaderCustomization(gl, true, null);
- gs.defaultShaderCustomization(gl, true, null);
- fs.defaultShaderCustomization(gl, true, null);
+ vs.defaultShaderCustomization(gl, true, true);
+ gs.defaultShaderCustomization(gl, true, true);
+ fs.defaultShaderCustomization(gl, true, true);
sp = new ShaderProgram();
sp.add(gl, vs, System.err);
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 04108eda5..65b86c6ab 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
@@ -75,8 +75,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
"shader", "shader/bin", "RedSquareShader", true);
final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class,
"shader", "shader/bin", "RedSquareShader", true);
- rsVp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- rsFp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ rsVp.defaultShaderCustomization(gl, true, true);
+ rsFp.defaultShaderCustomization(gl, true, true);
final ShaderProgram sp = new ShaderProgram();
Assert.assertTrue(0 == sp.program());
@@ -193,8 +193,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
"shader/bin", "RedSquareShader", true);
final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader",
"shader/bin", "RedSquareShader", true);
- rsVp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- rsFp.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ rsVp.defaultShaderCustomization(gl, true, true);
+ rsFp.defaultShaderCustomization(gl, true, true);
final ShaderProgram sp = new ShaderProgram();
Assert.assertTrue(0 == sp.program());
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 1ba7d9edb..2e783e974 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
@@ -86,9 +86,9 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
"shader/bin", "RedSquareShader", true);
final ShaderCode rsFp1 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader",
"shader/bin", "RedSquareShader2", true);
- rsVp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- rsFp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
- rsFp1.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ rsVp0.defaultShaderCustomization(gl, true, true);
+ rsFp0.defaultShaderCustomization(gl, true, true);
+ rsFp1.defaultShaderCustomization(gl, true, true);
final ShaderProgram sp1 = new ShaderProgram();
sp1.add(rsVp0);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
index 90d4a9c1f..658e3e7f3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
@@ -77,8 +77,8 @@ public class TestRulerNEWT01 extends UITestCase {
"shader/bin", "default", true);
final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader",
"shader/bin", "ruler", true);
- vp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_vp);
- fp0.defaultShaderCustomization(gl, true, ShaderCode.es2_default_precision_fp);
+ vp0.defaultShaderCustomization(gl, true, true);
+ fp0.defaultShaderCustomization(gl, true, true);
final ShaderProgram sp0 = new ShaderProgram();
sp0.add(gl, vp0, System.err);