aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-30 23:34:18 +0200
committerSven Gothel <[email protected]>2011-09-30 23:34:18 +0200
commite71c9485cd851b2b10bca1a801603f83b4ede946 (patch)
treebb95ba1eb8ba4df487998947348a59b5a2453562
parentefbb2e232a4d0f6a1782aa993ecca4621d7b5c51 (diff)
RedSquareES1: remove GLU dependency
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
index 38afec7f1..0484b6a77 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
@@ -5,7 +5,6 @@ import java.nio.*;
import javax.media.opengl.*;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
import javax.media.opengl.fixedfunc.GLPointerFunc;
-import javax.media.opengl.glu.*;
import com.jogamp.opengl.util.glsl.fixedfunc.*;
@@ -21,8 +20,6 @@ public class RedSquareES1 implements GLEventListener {
long startTime = 0;
long curTime = 0;
- GLU glu = null;
-
public RedSquareES1(int swapInterval) {
this.swapInterval = swapInterval;
}
@@ -74,12 +71,9 @@ public class RedSquareES1 implements GLEventListener {
} catch (Exception e) {e.printStackTrace();}
}
- glu = GLU.createGLU(gl);
-
System.err.println(Thread.currentThread()+" GL Profile: "+gl.getGLProfile());
System.err.println(Thread.currentThread()+" GL:" + gl);
System.err.println(Thread.currentThread()+" GL_VERSION=" + gl.glGetString(GL.GL_VERSION));
- System.err.println(Thread.currentThread()+" GLU: " + glu);
// Allocate vertex arrays
colors = Buffers.newDirectFloatBuffer(16);
@@ -114,11 +108,18 @@ public class RedSquareES1 implements GLEventListener {
// Set location in front of camera
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
- glu.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
- //gl.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
- //glu.gluLookAt(0, 0, -20, 0, 0, 0, 0, 1, 0);
+ gluPerspective(gl, 45.0f, (float)width / (float)height, 1.0f, 100.0f);
+ // gl.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
System.err.println(Thread.currentThread()+" RedSquareES1.reshape FIN");
}
+
+ void gluPerspective(GL2ES1 gl, final float fovy, final float aspect, final float zNear, final float zFar) {
+ float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
+ float bottom=-1.0f*top;
+ float left=aspect*bottom;
+ float right=aspect*top;
+ gl.glFrustumf(left, right, bottom, top, zNear, zFar);
+ }
public void display(GLAutoDrawable drawable) {
curTime = System.currentTimeMillis();
@@ -146,8 +147,6 @@ public class RedSquareES1 implements GLEventListener {
GL2ES1 gl = drawable.getGL().getGL2ES1();
gl.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
gl.glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
- glu.destroy();
- glu = null;
colors.clear();
colors = null;
vertices.clear();