PDA

View Full Version : access x, y, z after transformations?



mireazma
05-19-2014, 07:39 AM
At first I took it for granted but it turned out I don't have access to x, y and z directly for a model, after I draw it at some coordinates resulted from a series of rotatef()/translatef() transformations. I'm not sure even now I can't.
Question: what's the way to get x, y, z?
The only way I can think of to do it is to store the final matrix and retrieve it next frame and work up on it but it is both resource consuming and it looks sooo smelly.

Agent D
05-20-2014, 02:52 AM
You mention rotatef and translatef, so I assume you are using OpenGL(R) 2.x or older.

Perhaps the simplest way would be to take your transformation matrices and transform the model data "manually".

WIth OpenGL(R) >=3.0, you could use transform feedback.

With older OpenGL(R) version, you could maybe, somehow use feedback mode, but I'm not quite sure on that (never used it myself).

mireazma
05-20-2014, 08:26 AM
Thank you, I guess I'm going to do it manually.