summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-09 20:20:35 +0200
committerSven Gothel <[email protected]>2011-08-09 20:20:35 +0200
commit0c4537feba3d6c11f4b8fdd5bf2e436a86e3a58a (patch)
tree201340e00e952ce449957e707c8c7ef0c85adda3
parent26a187c320c52b9b66f64cdce8e71954d9475714 (diff)
Test OneTriangle generalization cleanup
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/OneTriangle.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java5
4 files changed, 17 insertions, 16 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/OneTriangle.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/OneTriangle.java
index 655e590a3..fa4d8190e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/OneTriangle.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/OneTriangle.java
@@ -26,35 +26,33 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.opengl.test.junit.jogl.swt;
+package com.jogamp.opengl.test.junit.jogl.demos.gl2;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.glu.GLU;
-import org.eclipse.swt.graphics.Rectangle;
-
/**
* A utility class to encapsulate drawing a single triangle for unit tests.
* @author Wade Walker
*/
public class OneTriangle {
- public static void setup( GL2 gl, Rectangle rectangle ) {
+ public static void setup( GL2 gl, int width, int height ) {
gl.glMatrixMode( GL2.GL_PROJECTION );
gl.glLoadIdentity();
// coordinate system origin at lower left with width and height same as the window
GLU glu = new GLU();
- glu.gluOrtho2D( 0.0f, rectangle.width, 0.0f, rectangle.height );
+ glu.gluOrtho2D( 0.0f, width, 0.0f, height );
gl.glMatrixMode( GL2.GL_MODELVIEW );
gl.glLoadIdentity();
- gl.glViewport( 0, 0, rectangle.width, rectangle.height );
+ gl.glViewport( 0, 0, width, height );
}
- public static void render( GL2 gl, Rectangle rectangle ) {
+ public static void render( GL2 gl, int width, int height) {
gl.glClear( GL.GL_COLOR_BUFFER_BIT );
// draw a triangle filling the window
@@ -63,9 +61,9 @@ public class OneTriangle {
gl.glColor3f( 1, 0, 0 );
gl.glVertex2f( 0, 0 );
gl.glColor3f( 0, 1, 0 );
- gl.glVertex2f( rectangle.width, 0 );
+ gl.glVertex2f( width, 0 );
gl.glColor3f( 0, 0, 1 );
- gl.glVertex2f( rectangle.width / 2, rectangle.height );
+ gl.glVertex2f( width / 2, height );
gl.glEnd();
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java
index af125d4df..2fe99eaab 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java
@@ -53,6 +53,7 @@ import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.OneTriangle;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
@@ -125,7 +126,7 @@ public class TestSWT01GLn extends UITestCase {
glcanvas.setCurrent();
glcontext.makeCurrent();
GL2 gl = glcontext.getGL().getGL2();
- OneTriangle.setup( gl, rectangle );
+ OneTriangle.setup( gl, rectangle.width, rectangle.height );
glcontext.release();
System.err.println("resize");
}
@@ -138,7 +139,7 @@ public class TestSWT01GLn extends UITestCase {
glcanvas.setCurrent();
glcontext.makeCurrent();
GL2 gl = glcontext.getGL().getGL2();
- OneTriangle.render( gl, rectangle );
+ OneTriangle.render( gl, rectangle.width, rectangle.height );
glcanvas.swapBuffers();
glcontext.release();
System.err.println("paint");
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java
index b3d167b80..1ee374895 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java
@@ -51,6 +51,7 @@ import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.OneTriangle;
import com.jogamp.opengl.test.junit.util.UITestCase;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.ProxySurface;
@@ -151,7 +152,7 @@ public class TestSWT02GLn extends UITestCase {
if( GLContext.CONTEXT_NOT_CURRENT < glcontext.makeCurrent() ) {
glok=true;
GL2 gl = glcontext.getGL().getGL2();
- OneTriangle.setup( gl, rectangle );
+ OneTriangle.setup( gl, rectangle.width, rectangle.height );
glcontext.release();
} else {
sizeMissing[0] = true;
@@ -169,10 +170,10 @@ public class TestSWT02GLn extends UITestCase {
glok=true;
GL2 gl = glcontext.getGL().getGL2();
if(sizeMissing[0]) {
- OneTriangle.setup( gl, rectangle );
+ OneTriangle.setup( gl, rectangle.width, rectangle.height);
sizeMissing[0] = false;
}
- OneTriangle.render( gl, rectangle );
+ OneTriangle.render( gl, rectangle.width, rectangle.height);
drawable.swapBuffers();
glcontext.release();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java
index 25653ab21..db95f9660 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java
@@ -52,6 +52,7 @@ import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.OneTriangle;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
@@ -133,14 +134,14 @@ public class TestSWTAWT01GLn extends UITestCase {
public void display( GLAutoDrawable glautodrawable ) {
Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getWidth(), glautodrawable.getHeight() );
GL2 gl = glautodrawable.getGL().getGL2();
- OneTriangle.render( gl, rectangle );
+ OneTriangle.render( gl, rectangle.width, rectangle.height );
}
/* @Override */
public void reshape( GLAutoDrawable glautodrawable, int x, int y, int width, int height ) {
Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getWidth(), glautodrawable.getHeight() );
GL2 gl = glautodrawable.getGL().getGL2();
- OneTriangle.setup( gl, rectangle );
+ OneTriangle.setup( gl, rectangle.width, rectangle.height );
}
});