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/com/jogamp/opengl/util | |
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/com/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 39608b116..289183b8e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -644,8 +644,8 @@ public final class PMVMatrix implements GLMatrixFunc { } @Override - public final void glRotatef(final float angdeg, final float x, final float y, final float z) { - glMultMatrixf(FloatUtil.makeRotationAxis(mat4Tmp1, 0, angdeg * FloatUtil.PI / 180.0f, x, y, z, mat4Tmp2), 0); + public final void glRotatef(final float ang_deg, final float x, final float y, final float z) { + glMultMatrixf(FloatUtil.makeRotationAxis(mat4Tmp1, 0, ang_deg * FloatUtil.PI / 180.0f, x, y, z, mat4Tmp2), 0); } /** @@ -671,9 +671,14 @@ 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 aspect aspect ratio + * @param zNear + * @param zFar */ - public final void gluPerspective(final float fovy, final float aspect, final float zNear, final float zFar) { - glMultMatrixf( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy*((float)Math.PI)/360.0f, aspect, zNear, zFar), 0 ); + public final void gluPerspective(final float fovy_deg, final float aspect, final float zNear, final float zFar) { + glMultMatrixf( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0 ); } /** |