PDA

View Full Version : How to get calculated values ?



wir33658
04-02-2003, 04:15 AM
Hi, I try to figure out, how to get the calculated values of an object after eg. an rotation.

For example:
double x1,y1,z1, x2,y2,z2;
x1 = 0.1;y1 = 0.1; z1 = 0.1;
x2 = 0.5;y2 = 0.5; z2 = 0.5;

// how to rotate doesn't matter
glRotate(an_angle, xaxis, yaxis, zaxis);
glBegin (GL_LINES);
glVertex3f(x1, y1, z1);
glVertex3f(x2, y2, z2);
glEnd();

-> so, how do I figure out the new coordinates of the line ?(which I need for further calculations) After the rotation.

thanx in advance.

satan
04-02-2003, 04:27 AM
OpenGL does not give any information about vertex positions after transforms are applied.
So I think if you really need the transformed verticies you have to do it on your own.
You need to setup a rotation matrix and multiply your verts with this matrix to get the transformed values.

hih

miko
04-03-2003, 07:14 AM
you can use glGet to load current matrix and then mutliply vertex by this matrix yourself.

for complex transformations this can be
faster than builing matrix yourself, because gl can be able to compute matrices faster.

kehziah
04-03-2003, 10:43 AM
Search for OpenGL Feedback Mode. Beware, Feedback mode means software path.