From 7c76354038ea96c884028d34efa1b8b39363ba49 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 22 Feb 2012 03:46:06 +0100 Subject: Test (graph) fixes for ES - MSAATool: Catch gl-errors on glIsEnabled(..) queries - Call MSAATool.dump(..) in base class GPURendererListenerBase01 --- .../test/junit/graph/TestTextRendererNEWT01.java | 120 ++++++++++++++------- .../junit/graph/demos/GPURegionGLListener01.java | 1 - .../junit/graph/demos/GPURegionGLListener02.java | 1 - .../graph/demos/GPURendererListenerBase01.java | 6 +- .../junit/graph/demos/GPUTextGLListener0A.java | 1 - .../opengl/test/junit/graph/demos/MSAATool.java | 26 +++-- .../junit/graph/demos/ui/UIListenerBase01.java | 5 +- 7 files changed, 108 insertions(+), 52 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index 8f03af7c9..5a5f9debb 100755 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -2,7 +2,6 @@ package com.jogamp.opengl.test.junit.graph; import java.io.IOException; -import javax.media.nativewindow.NativeWindowFactory; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; @@ -12,7 +11,6 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import org.junit.Assert; -import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.graph.curve.Region; @@ -29,12 +27,32 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class TestTextRendererNEWT01 extends UITestCase { static final boolean DEBUG = false; static final boolean TRACE = false; + static long duration = 100; // ms + static int atoi(String a) { + try { + return Integer.parseInt(a); + } catch (Exception ex) { throw new RuntimeException(ex); } + } + public static void main(String args[]) throws IOException { + for(int i=0; i error 0x"+Integer.toHexString(glerr)); + } + } catch (Exception e) { + System.err.println("Catched Exception: "+e.getMessage()); + // e.printStackTrace(); + } + return isEnabled; + } public static void dump(GLAutoDrawable drawable) { float[] vf = new float[] { 0f }; byte[] vb = new byte[] { 0 }; @@ -44,8 +59,7 @@ public class MSAATool { System.out.println(" Caps realised "+caps); System.out.println(" Caps sample buffers "+caps.getSampleBuffers()+", samples "+caps.getNumSamples()); - // default TRUE - System.out.println(" GL MULTISAMPLE "+gl.glIsEnabled(GL2ES2.GL_MULTISAMPLE)); + System.out.println(" GL MULTISAMPLE "+glIsEnabled(gl, GL2ES2.GL_MULTISAMPLE)); // sample buffers min 0, same as GLX_SAMPLE_BUFFERS_ARB or WGL_SAMPLE_BUFFERS_ARB gl.glGetIntegerv(GL2GL3.GL_SAMPLE_BUFFERS, vi, 0); // samples min 0 @@ -54,15 +68,15 @@ public class MSAATool { System.out.println("GL CSAA SETUP:"); // default FALSE - System.out.println(" GL SAMPLE COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE)); + System.out.println(" GL SAMPLE COVERAGE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_COVERAGE)); // default FALSE - System.out.println(" GL SAMPLE_ALPHA_TO_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE)); + System.out.println(" GL SAMPLE_ALPHA_TO_COVERAGE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE)); // default FALSE - System.out.println(" GL SAMPLE_ALPHA_TO_ONE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE)); + System.out.println(" GL SAMPLE_ALPHA_TO_ONE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_ALPHA_TO_ONE)); // default FALSE, value 1, invert false gl.glGetFloatv(GL2GL3.GL_SAMPLE_COVERAGE_VALUE, vf, 0); gl.glGetBooleanv(GL2GL3.GL_SAMPLE_COVERAGE_INVERT, vb, 0); - System.out.println(" GL SAMPLE_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE) + + System.out.println(" GL SAMPLE_COVERAGE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_COVERAGE) + ": SAMPLE_COVERAGE_VALUE "+vf[0]+ ", SAMPLE_COVERAGE_INVERT "+vb[0]); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java index 0fe48e550..d9d2dd95a 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java @@ -180,8 +180,9 @@ public abstract class UIListenerBase01 implements GLEventListener { pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zoom), 0, objName); final String filename = dir + tech + sw +".tga"; - screenshot.readPixels(drawable.getGL(), drawable, false); - screenshot.write(new File(filename)); + if(screenshot.readPixels(drawable.getGL(), drawable, false)) { + screenshot.write(new File(filename)); + } } int screenshot_num = 0; -- cgit v1.2.3