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/test/com/jogamp/opengl | |
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/test/com/jogamp/opengl')
8 files changed, 20 insertions, 14 deletions
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()); |