aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-02 20:24:23 +0200
committerSven Gothel <[email protected]>2023-09-02 20:24:23 +0200
commit71576e94af890e2a4a98225ed258445ba7db0f26 (patch)
tree2e07d6a18f7394d394459a98414ad8c16984d0ed
parentf6dd8e9562d7e0bbf681c268f40ff4c819057915 (diff)
PMVMatrix.gluPerspective(): Redfine angle in radians instead of degrees ** API Change **
Since this is an extra implementation of PMVMatrix and not of GLMatrixFunc, we shall use the default ISO dimension avoiding conversion. This alsi redefined Graph's RegionRenderer.reshapePerspective() angle definition from degrees to radians
-rw-r--r--src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java3
-rw-r--r--src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java4
-rw-r--r--src/demos/com/jogamp/opengl/demos/es2/TextureSequenceCubeES2.java4
-rw-r--r--src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java3
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java3
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Scene.java4
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java4
19 files changed, 53 insertions, 32 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java b/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java
index 37bf5489e..c95d8447d 100644
--- a/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java
+++ b/src/demos/com/jogamp/opengl/demos/av/MovieSBSStereo.java
@@ -61,6 +61,7 @@ import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.demos.graph.TextRendererGLELBase;
import com.jogamp.opengl.demos.util.MiscUtils;
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.Matrix4f;
import com.jogamp.opengl.math.Quaternion;
import com.jogamp.opengl.math.Recti;
@@ -630,7 +631,7 @@ public class MovieSBSStereo implements StereoGLEventListener {
private void reshapePMV(final int width, final int height) {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, zNear, zFar);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float)width / (float)height, zNear, zFar);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
diff --git a/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java b/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java
index 93cc16711..15f146a26 100644
--- a/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java
+++ b/src/demos/com/jogamp/opengl/demos/es2/PointsDemoES2.java
@@ -51,7 +51,7 @@ import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
-
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.demos.PointsDemo;
import com.jogamp.opengl.demos.util.CommandlineOptions;
@@ -207,7 +207,7 @@ public class PointsDemoES2 extends PointsDemo {
// Set location in front of camera
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, ( (float) width / (float) height ) / 1.0f, 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, ( (float) width / (float) height ) / 1.0f, 1.0F, 100.0F);
//pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
diff --git a/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceCubeES2.java b/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceCubeES2.java
index e9a2ad66d..5aa43b073 100644
--- a/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceCubeES2.java
+++ b/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceCubeES2.java
@@ -38,7 +38,7 @@ import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
-
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.common.os.Platform;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.MouseAdapter;
@@ -335,7 +335,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
if(!innerCube) {
- pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1f, 10.0f);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float)width / (float)height, 1f, 10.0f);
nearPlaneNormalized = 1f/(100f-1f);
} else {
pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 10.0f);
diff --git a/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java b/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java
index c556f2a2f..8496f3ee8 100644
--- a/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java
+++ b/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java
@@ -40,6 +40,7 @@ import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.Recti;
import com.jogamp.opengl.math.Vec3f;
import com.jogamp.opengl.util.GLArrayDataServer;
@@ -302,7 +303,7 @@ public class TextureSequenceES2 implements GLEventListener {
pmvMatrix.glOrthof(-fw, fw, -fh, fh, -1.0f, 1.0f);
nearPlaneNormalized = 0f;
} else {
- pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, zNear, zFar);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float)width / (float)height, zNear, zFar);
nearPlaneNormalized = 1f/(10f-1f);
}
System.err.println("XXX0: Perspective nearPlaneNormalized: "+nearPlaneNormalized);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
index d02764cc0..8655def4a 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/GPURendererListenerBase01.java
@@ -50,6 +50,7 @@ import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.Recti;
import com.jogamp.opengl.math.Vec3f;
import com.jogamp.opengl.math.geom.AABBox;
@@ -159,7 +160,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
@Override
public void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height) {
final PMVMatrix pmv = renderer.getMatrix();
- renderer.reshapePerspective(45.0f, width, height, zNear, zFar);
+ renderer.reshapePerspective(FloatUtil.QUARTER_PI, width, height, zNear, zFar);
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmv.glLoadIdentity();
System.err.printf("Reshape: zNear %f, zFar %f%n", zNear, zFar);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
index e9779eb29..6c424d42c 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIGraphDemoU01a.java
@@ -199,7 +199,7 @@ public class UIGraphDemoU01a {
zFar = 1f;
sceneDist = zNear;
} else {
- angle = 45.0f;
+ angle = FloatUtil.QUARTER_PI;
zNear = 0.1f;
zFar = 7000.0f;
sceneDist = -zNear;
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
index c1dbaf700..cc918c9fe 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
@@ -221,7 +221,7 @@ public class UIShapeDemo01 implements GLEventListener {
// final GL2ES2 gl = drawable.getGL().getGL2ES2();
// gl.glViewport(xstart, ystart, width, height);
- rRenderer.reshapePerspective(45.0f, width, height, zNear, zFar);
+ rRenderer.reshapePerspective(FloatUtil.QUARTER_PI, width, height, zNear, zFar);
// rRenderer.reshapeOrtho(width, height, zNear, zFar);
final PMVMatrix pmv = rRenderer.getMatrix();
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
index eb69bfb58..ecd7b1ccf 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
@@ -244,7 +244,7 @@ public class UITypeDemo01 implements GLEventListener {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glViewport(xstart, ystart, width, height);
- rRenderer.reshapePerspective(45.0f, width, height, zNear, zFar);
+ rRenderer.reshapePerspective(FloatUtil.QUARTER_PI, width, height, zNear, zFar);
// rRenderer.reshapeOrtho(width, height, zNear, zFar);
lastWidth = width;
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
index 6abbc7f08..39bf12140 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
@@ -99,8 +99,8 @@ import jogamp.graph.ui.TreeTool;
public final class Scene implements Container, GLEventListener {
/** Default scene distance on z-axis to projection is -1/5f. */
public static final float DEFAULT_SCENE_DIST = -1/5f;
- /** Default projection angle in degrees value is 45.0. */
- public static final float DEFAULT_ANGLE = 45.0f;
+ /** Default projection angle in radians is PI/4, i.e. 45.0 degrees. */
+ public static final float DEFAULT_ANGLE = FloatUtil.QUARTER_PI;
/** Default projection z-near value is 0.1. */
public static final float DEFAULT_ZNEAR = 0.1f;
/** Default projection z-far value is 7000. */
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index 8b3fb3a82..0c939d015 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -362,17 +362,29 @@ public final class RegionRenderer {
viewport.set(x, y, width, height);
}
- public final void reshapePerspective(final float angle, final int width, final int height, final float near, final float far) {
+ /**
+ * Perspective projection, method also calls {@link #reshapeNotify(int, int, int, int)}.
+ * @param angle_rad perspective angle in radians
+ * @param width viewport width
+ * @param height viewport height
+ * @param near projection z-near
+ * @param far projection z-far
+ */
+ public final void reshapePerspective(final float angle_rad, final int width, final int height, final float near, final float far) {
reshapeNotify(0, 0, width, height);
final float ratio = (float)width/(float)height;
final PMVMatrix p = getMatrix();
p.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
p.glLoadIdentity();
- p.gluPerspective(angle, ratio, near, far);
+ p.gluPerspective(angle_rad, ratio, near, far);
}
/**
- * Perspective orthogonal, method calls {@link #reshapeNotify(int, int, int, int)}.
+ * Orthogonal projection, method also calls {@link #reshapeNotify(int, int, int, int)}.
+ * @param width viewport width
+ * @param height viewport height
+ * @param near projection z-near
+ * @param far projection z-far
*/
public final void reshapeOrtho(final int width, final int height, final float near, final float far) {
reshapeNotify(0, 0, width, height);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index b8b2925ae..ebb164912 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -1038,15 +1038,15 @@ public final class PMVMatrix implements GLMatrixFunc {
/**
* {@link #glMultMatrixf(FloatBuffer) Multiply} the {@link #glGetMatrixMode() current matrix} with the perspective/frustum matrix.
*
- * @param fovy_deg fov angle in degrees
+ * @param fovy_rad fov angle in radians
* @param aspect aspect ratio width / height
* @param zNear
* @param zFar
* @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
* @see Matrix4f#setToPerspective(float, float, float, float)
*/
- public final void gluPerspective(final float fovy_deg, final float aspect, final float zNear, final float zFar) throws GLException {
- glMultMatrixf( mat4Tmp1.setToPerspective(FloatUtil.adegToRad(fovy_deg), aspect, zNear, zFar) );
+ public final void gluPerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar) throws GLException {
+ glMultMatrixf( mat4Tmp1.setToPerspective(fovy_rad, aspect, zNear, zFar) );
}
/**
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java
index 3cc5b628f..7d14dcf17 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURendererListenerBase01.java
@@ -50,6 +50,7 @@ import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.Recti;
import com.jogamp.opengl.math.Vec3f;
import com.jogamp.opengl.math.geom.AABBox;
@@ -159,7 +160,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
@Override
public void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height) {
final PMVMatrix pmv = renderer.getMatrix();
- renderer.reshapePerspective(45.0f, width, height, zNear, zFar);
+ renderer.reshapePerspective(FloatUtil.QUARTER_PI, width, height, zNear, zFar);
pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmv.glLoadIdentity();
System.err.printf("Reshape: zNear %f, zFar %f%n", zNear, zFar);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
index 1d05d16a1..eebce5a5d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
@@ -44,6 +44,7 @@ import com.jogamp.opengl.GL2GL3;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.math.FloatUtil;
public class PointsDemoES2 extends PointsDemo {
ShaderState st;
@@ -197,7 +198,7 @@ public class PointsDemoES2 extends PointsDemo {
// Set location in front of camera
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, ( (float) width / (float) height ) / 1.0f, 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, ( (float) width / (float) height ) / 1.0f, 1.0F, 100.0F);
//pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
index 4c2b5d57d..3f4be9833 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
@@ -38,7 +38,7 @@ import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
-
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.common.os.Platform;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.MouseAdapter;
@@ -337,7 +337,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
if(!innerCube) {
- pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1f, 10.0f);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float)width / (float)height, 1f, 10.0f);
nearPlaneNormalized = 1f/(100f-1f);
} else {
pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 10.0f);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java
index 9799ee6b6..da799906a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TriangleInstancedRendererWithShaderState.java
@@ -17,6 +17,7 @@ import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.TraceGL4;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.Matrix4f;
import com.jogamp.opengl.math.Vec3f;
import com.jogamp.opengl.util.GLArrayDataClient;
@@ -169,7 +170,7 @@ public class TriangleInstancedRendererWithShaderState implements GLEventListener
projectionMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
projectionMatrix.glLoadIdentity();
- projectionMatrix.gluPerspective(45, aspect, 0.001f, 20f);
+ projectionMatrix.gluPerspective(FloatUtil.QUARTER_PI, aspect, 0.001f, 20f);
projectionMatrix.gluLookAt(new Vec3f(0, 0, -10), new Vec3f(0, 0, 0), new Vec3f(0, 1, 0));
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java
index aa2a0ee6a..986f60550 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl4/TrianglesInstancedRendererHardcoded.java
@@ -16,6 +16,7 @@ import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.TraceGL4;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.Matrix4f;
import com.jogamp.opengl.math.Vec3f;
import com.jogamp.opengl.util.PMVMatrix;
@@ -120,7 +121,7 @@ public class TrianglesInstancedRendererHardcoded implements GLEventListener {
projectionMatrix = new PMVMatrix();
projectionMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
projectionMatrix.glLoadIdentity();
- projectionMatrix.gluPerspective(45, aspect, 0.001f, 20f);
+ projectionMatrix.gluPerspective(FloatUtil.QUARTER_PI, aspect, 0.001f, 20f);
projectionMatrix.gluLookAt(new Vec3f(0, 0, -10), new Vec3f(0, 0, 0), new Vec3f(0, 1, 0));
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
index e40eb4b46..cd68eb0ce 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java
@@ -46,6 +46,7 @@ import com.jogamp.opengl.GLDrawable;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.math.FloatUtil;
import org.junit.Assert;
import org.junit.Test;
@@ -152,7 +153,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
@@ -272,7 +273,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
@@ -355,7 +356,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
@@ -452,7 +453,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
index 6f2265574..73c166abb 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java
@@ -47,6 +47,7 @@ import com.jogamp.opengl.GLDrawable;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.math.FloatUtil;
import org.junit.Assert;
import org.junit.Test;
@@ -143,7 +144,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase {
// reshape
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
@@ -345,7 +346,7 @@ com.jogamp.opengl.GLException: Thread[main,5,main] glGetError() returned the fol
// reshape
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java
index b4226b583..b82d70923 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java
@@ -36,7 +36,7 @@ import com.jogamp.opengl.fixedfunc.*;
import com.jogamp.opengl.util.*;
import com.jogamp.opengl.fixedfunc.GLPointerFunc;
-
+import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.util.texture.TextureCoords;
import com.jogamp.opengl.util.GLArrayDataClient;
import com.jogamp.opengl.util.GLArrayDataServer;
@@ -114,7 +114,7 @@ public class ReadBuffer2Screen extends ReadBufferBase {
// Set location in front of camera
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
+ pmvMatrix.gluPerspective(FloatUtil.QUARTER_PI, (float)width / (float)height, 1.0f, 100.0f);
if(null!=glM) {
glM.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
glM.glLoadMatrixf(pmvMatrix.getSyncPMat().getSyncFloats());