From e2ceb1af352ec73967f2c15341d10fa3069b0a84 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 14 Mar 2014 08:26:01 +0100 Subject: PMVMatrix.glLoadMatrix(Quaternion): Load Quaternion's directly w/o intermediate matrix --- src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java') diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 2d88f7937..6db726b01 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -540,8 +540,21 @@ public class PMVMatrix implements GLMatrixFunc { * Load the current matrix with the values of the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}. */ public final void glLoadMatrix(final Quaternion quat) { - quat.toMatrix(tmpMatrix, 0); - glLoadMatrixf(tmpMatrix, 0); + if(matrixMode==GL_MODELVIEW) { + quat.toMatrix(matrixMv); + matrixMv.reset(); + dirtyBits |= DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM ; + modifiedBits |= MODIFIED_MODELVIEW; + } else if(matrixMode==GL_PROJECTION) { + quat.toMatrix(matrixP); + matrixP.reset(); + dirtyBits |= DIRTY_FRUSTUM ; + modifiedBits |= MODIFIED_PROJECTION; + } else if(matrixMode==GL.GL_TEXTURE) { + quat.toMatrix(matrixTex); + matrixTex.reset(); + modifiedBits |= MODIFIED_TEXTURE; + } } @Override -- cgit v1.2.3