diff options
author | Sven Gothel <[email protected]> | 2023-09-02 20:24:23 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-02 20:24:23 +0200 |
commit | 71576e94af890e2a4a98225ed258445ba7db0f26 (patch) | |
tree | 2e07d6a18f7394d394459a98414ad8c16984d0ed /src/demos/com/jogamp | |
parent | f6dd8e9562d7e0bbf681c268f40ff4c819057915 (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
Diffstat (limited to 'src/demos/com/jogamp')
8 files changed, 13 insertions, 10 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; |