From: Prashant S. <ani...@ya...> - 2008-07-22 10:16:03
glPushMatrix()
glTranslate(5,0,0)
glTranslate(10,0,0)
glTranslate(5,0,0)
# How do I get here total increment of x axis(which is 5+10+5=20) before I Pop up.
glPopMatrix()
Shantytown Saxena wrote:
>
> glPushMatrix()
> glTranslate(5,0,0)
> glTranslate(10,0,0)
> glTranslate(5,0,0)
> # How do I get here total increment of x axis(which is 5+10+5=20)
> before I Pop up.
> glPopMatrix()
All the transformations are recorded by OpenGL in a 4x4 matrix.
You can recover that matrix like this:
buff = (ctypes.c_double*16)()
pyglet.gl.glGetDoublev(stack, buff)
If you started with the identity and did no other transformations you'll
find the 20 in that 4x4 array.
In either the [0,3] or [3,0] element. (I've forgotten which way Opengl
stores the array now.)
Gary Herron
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> PyOpenGL Homepage
> http://pyopengl.sourceforge.net
> _______________________________________________
> PyOpenGL-Users mailing list
> PyO...@li...
> https://lists.sourceforge.net/lists/listinfo/pyopengl-users
>
From: Greg E. <gre...@ca...> - 2008-07-23 00:33:31
Gary Herron wrote:
> All the transformations are recorded by OpenGL in a 4x4 matrix.
> You can recover that matrix like this:
>
> buff = (ctypes.c_double*16)()
> pyglet.gl.glGetDoublev(stack, buff)
However, reading back the OpenGL matrix as part of your
rendering process isn't really a good thing to do, since
it requires waiting for any pipelined OpenGL commands
that you've sent to complete. This can slow things down
considerably.
If you're doing this a lot, it may be better to keep
track of the transformations yourself.
--
Greg