Skip to content

Commit

Permalink
TestGearsES2NEWT: Adding programmatic Debug|Trace pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
sgothel committed Oct 12, 2015
1 parent d285de0 commit 90e9104
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
8 changes: 4 additions & 4 deletions make/scripts/tests.sh
Expand Up @@ -252,7 +252,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.GLDrawable"
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent"
D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Dnewt.debug.Window.visibility.failure.freeze"
#D_ARGS="-Xprof"
#D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
Expand Down Expand Up @@ -429,6 +429,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile03NEWTOffscreen $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $*
#

#
# Stereo
Expand All @@ -438,7 +439,7 @@ function testawtswt() {
#
# HiDPI
#
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2SimpleNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
Expand Down Expand Up @@ -809,8 +810,7 @@ function testawtswt() {
# Bug 1249 - NEWT X11:
# - setVisible(false) IconicState not listening to _NET_WM_STATE_HIDDEN;
# - setVisible(true) not restoring from _NET_WM_STATE_HIDDEN
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT
#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT
Expand Down
Expand Up @@ -58,11 +58,13 @@
import com.jogamp.nativewindow.util.Point;
import com.jogamp.nativewindow.util.PointImmutable;
import com.jogamp.nativewindow.util.DimensionImmutable;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLAnimatorControl;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLPipelineFactory;
import com.jogamp.opengl.GLProfile;

import jogamp.newt.DefaultEDTUtil;
Expand Down Expand Up @@ -104,6 +106,8 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean forceES3 = false;
static boolean forceGL3 = false;
static boolean forceGL2 = false;
static boolean forceDebug = false;
static boolean forceTrace = false;
static int demoType = 1;
static boolean traceMouse = false;
static boolean manualTest = false;
Expand Down Expand Up @@ -160,6 +164,33 @@ protected void runTestGL(final GLCapabilitiesImmutable caps, final boolean undec
} else {
demo = null;
}
if( forceDebug || forceTrace ) {
glWindow.addGLEventListener(new GLEventListener() {
@Override
public void init(final GLAutoDrawable drawable) {
GL _gl = drawable.getGL();
if(forceDebug) {
try {
_gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null) );
} catch (final Exception e) {e.printStackTrace();}
}

if(forceTrace) {
try {
// Trace ..
_gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, _gl, new Object[] { System.err } ) );
} catch (final Exception e) {e.printStackTrace();}
}
}
@Override
public void dispose(final GLAutoDrawable drawable) {}
@Override
public void display(final GLAutoDrawable drawable) {}
@Override
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {}
});
}

if( null != demo ) {
glWindow.addGLEventListener(demo);
}
Expand Down Expand Up @@ -468,6 +499,10 @@ public static void main(final String args[]) throws IOException {
forceGL3 = true;
} else if(args[i].equals("-gl2")) {
forceGL2 = true;
} else if(args[i].equals("-debug")) {
forceDebug = true;
} else if(args[i].equals("-trace")) {
forceTrace = true;
} else if(args[i].equals("-mappedBuffers")) {
useMappedBuffers = true;
} else if(args[i].equals("-wait")) {
Expand Down Expand Up @@ -556,6 +591,8 @@ public static void main(final String args[]) throws IOException {
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGL2 "+forceGL2);
System.err.println("forceDebug "+forceDebug);
System.err.println("forceTrace "+forceTrace);
System.err.println("swapInterval "+swapInterval);
System.err.println("exclusiveContext "+exclusiveContext);
System.err.println("useAnimator "+useAnimator);
Expand Down

0 comments on commit 90e9104

Please sign in to comment.