glTranslated

Hi,

Anybody know how I can get the result of glTranslated? I mean I want something like

OutputMatrix = glTranslated(tx, ty, tz).

I know I can it indirectly by using

void glGetFloatv( GL_*_MATRIX, OutputMatrix)

with proper setup. That is not straightforward and it invovles matrix mode changes, etc.

Hi !

Short answer is no, it is never a good idea to try to get information back from OpenGL because it will probably stall the OpenGL pipeline and it is not very fast.

The easiest thing to do is to keep the information yourself, translate the vertex yourself and then pass it to OpenGL and drop the glTranslate call instead if you must know the resulting value.

Mikael

Hi, Mikael:

Thanks for the reply. That means OpenGL does not have any utility function for matrix operations. What I mean is I want to some util functions that get the transformation matrix so that I can transform my vertex out of the context of OpenGL pipeline and later feed OpenGL with already transformed vertex.

Originally posted by mikael_aronsson:
[b]Hi !

Short answer is no, it is never a good idea to try to get information back from OpenGL because it will probably stall the OpenGL pipeline and it is not very fast.

Mikael[/b]

Hi !

OpenGL support glMultMatrix that you can use to do your own matrix operations and pass the resulting matrix to OpenGL, but if you want to poke around with the matrices yourself you will not get any support from OpenGL, that is a pure rendering api.

But there are lots of libraries to do vector/matrix operations, have a peek at www.sourceforge.net

Mikael

Appendix G of the Redbook lists all matrices that are produced by the GL transformation commands. You can use that and implement your own version of these commands…

http://rush3d.com/reference/opengl-redbook-1.1/appendixg.html