diff options
author | Sven Gothel <[email protected]> | 2014-07-05 08:27:03 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-05 08:27:03 +0200 |
commit | bda482e4eee76a5ba2139645682ae64dadacbc6b (patch) | |
tree | 51f67d3734276114754bff02bbde2217fc0fb797 /src/jogl/classes/jogamp/opengl/ProjectFloat.java | |
parent | f8f0f051604721bceaee214b8e5218fd47d2eb9e (diff) |
Fix FloatUtil.makePerspective(..): The tan(fovy/2) shall be used, not tan(fovy), fix callers; Simplify FloatUtil.makePerspective(..FovHVHalves..)
Fix FloatUtil.makePerspective(..): The tan(fovy/2) shall be used, not tan(fovy), fix callers
- This bug didn't hit (yet), since callers already performed the division (degree -> radian)
by falsly claiming the passed value is in radian - where it was actually fov/2 in radians.
Simplify FloatUtil.makePerspective(..FovHVHalves..)
- Due to the fix above, it became pretty clear that the makeFrustum(..)
method can be utilized.
Simply apply all our tan-half-fov values on zNear.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/ProjectFloat.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/ProjectFloat.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java index 2c7989237..5921eb9a9 100644 --- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java +++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java @@ -165,13 +165,13 @@ public class ProjectFloat { /** * Method gluPerspective. * - * @param fovy angle in degrees + * @param fovy_deg fov angle in degrees * @param aspect * @param zNear * @param zFar */ - public void gluPerspective(final GLMatrixFunc gl, final float fovy, final float aspect, final float zNear, final float zFar) { - gl.glMultMatrixf(FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy / 2 * (float) Math.PI / 180, aspect, zNear, zFar), 0); + public void gluPerspective(final GLMatrixFunc gl, final float fovy_deg, final float aspect, final float zNear, final float zFar) { + gl.glMultMatrixf(FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0); } /** @@ -235,6 +235,7 @@ public class ProjectFloat { /** * Map object coordinates to window coordinates. */ + @SuppressWarnings("deprecation") public boolean gluProject(final float objx, final float objy, final float objz, final FloatBuffer modelMatrix, final FloatBuffer projMatrix, @@ -283,6 +284,7 @@ public class ProjectFloat { * * @return */ + @SuppressWarnings("deprecation") public boolean gluProject(final float objx, final float objy, final float objz, final FloatBuffer modelMatrix, final FloatBuffer projMatrix, @@ -365,6 +367,7 @@ public class ProjectFloat { * @param obj_pos_offset * @return true if successful, otherwise false (failed to invert matrix, or becomes z is infinity) */ + @SuppressWarnings("deprecation") public boolean gluUnProject(final float winx, final float winy, final float winz, final FloatBuffer modelMatrix, final FloatBuffer projMatrix, @@ -422,6 +425,7 @@ public class ProjectFloat { * * @return true if successful, otherwise false (failed to invert matrix, or becomes z is infinity) */ + @SuppressWarnings("deprecation") public boolean gluUnProject(final float winx, final float winy, final float winz, final FloatBuffer modelMatrix, final FloatBuffer projMatrix, @@ -523,6 +527,7 @@ public class ProjectFloat { * * @return true if successful, otherwise false (failed to invert matrix, or becomes z is infinity) */ + @SuppressWarnings("deprecation") public boolean gluUnProject4(final float winx, final float winy, final float winz, final float clipw, final FloatBuffer modelMatrix, final FloatBuffer projMatrix, final IntBuffer viewport, |