diff options
author | Rami Santina <[email protected]> | 2011-10-01 01:03:21 +0300 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-10-01 01:03:21 +0300 |
commit | 321720090314836d663b0bed0925c0cea76193e0 (patch) | |
tree | 4842da5abdbe99f488565f5ce7cdba9fffe8c68c /src/test/com/jogamp/opengl | |
parent | 564574004cd2eb279a77b9c4040b02bd2bbdd44a (diff) | |
parent | e29d192999c676a5e3472df6daadd14fc8b69227 (diff) |
merge with sgothel
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java | 21 |
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(); |