PDA

View Full Version : glTranslated



zero_t9
03-31-2005, 08:18 PM
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.

mikael_aronsson
03-31-2005, 10:57 PM
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

zero_t9
03-31-2005, 11:21 PM
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:
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

mikael_aronsson
04-01-2005, 04:21 AM
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 (http://www.sourceforge.net)

Mikael

Overmind
04-01-2005, 04:39 AM
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