Re: Viewing transformations cleared after glLoadMatrix
Posted by
andys on
Dec 09, 2010; 2:03pm
URL: https://forum.jogamp.org/Viewing-transformations-cleared-after-glLoadMatrix-tp2056651p2057815.html
puuhhh,
another 2 hours hard thinking and endless try and error code testing i found this fix for my glLoadMatrix() thing:
I shouldn't load the matrix via glLoadMatrix!
gl.glLoadMatrixf(glMat, 0); ---> draws objects o.k., but wipes out my view transformation even if i Push/Pop Modelview Matrix
Instead:
i should multiply current ModelView Matrix via glMultMatrix with it!
gl.glMultMatrixf(glMat, 0); ---> draws objects o.k. AND keeps my view transformation
Honestly: i have no idea why i need to multiply instead of just replacing the current ModelView matrix. I just tried all possible commands which manipulate the matrix - and this one did exactly what i need to keep my view transformation. The main thing what REALLY puzzles me is: why the glLoadMatrix change cannot be undone via a Push/Pop?????
Still i do absolutely not understand why my view transformation is gone if i
-) Push Matrix - i even pushed all Attributes via glPushAttrib(GL2.GL_ALL_ATTRIB_BITS)
-) replace the current modelview matrix via glLoadMatrix
-) draw the object
-) Pop Matrix (and all Attributes)
Maybe somebody has a basic explanation for me - could it be something inside JBullet code which neutralizes any previous,post transformations? .
I have to admit that my level of Matrix understanding is still pretty basic. Getting normals via cross product is o.k. , but beyond that ... very feeble knowledge, but improving

.
Cheers
Andy