View Full Version : OpenGL rotations
I have a polygon with distinct coordinates that I am rotating an arbitrary amount about an arbitrary axis (both depend on the mouse coordinates). After displaying the polygon, I can clearly see that it has been rotated, but how can I retrieve the new coordinates of the polygon AFTER it's been channeled through the rotation matrix?
11-05-2004, 01:14 PM
Try glFeedbackBuffer with type GL_3D. Be warned, though, that it won't be very efficient. OpenGL is primarily a one-way drawing API and isn't intended to be a general-purpose geometry calculator. If you're going to be doing lots of this in a serious app, either write your own 3D math library or use one of the many freely available ones. (The latter is obviously quicker, but the former is far more instructive.)
11-05-2004, 01:50 PM
Alternatively, you can pull the modelview matrix out with a glGetFloatv(GL_MODELVIEW_MATRIX, matrixPointer) where matrixPointer is a pointer to 16 floats then multiply the coordinates out yourself.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.