Revision: 34494
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 23, 2010 05:53 by waldir
Initial Code
double modelview[16]; double projection[16]; int viewport[4]; double screenX, screenY, screenZ; glGetDoublev(GL_MODELVIEW_MATRIX, modelview); glGetDoublev(GL_PROJECTION_MATRIX, projection); glGetIntegerv(GL_VIEWPORT, viewport); //you'll probably want to put this inside a loop, to get all the model's points gluProject(modelPointX, modelPointY, modelPointZ, modelview, projection, viewport, &screenX, &screenY, &screenZ);
Initial URL
http://www.opengl.org/sdk/docs/man/xhtml/gluProject.xml
Initial Description
This is the full sequence of commands needed to make a gluProject call to get the 2D projections of 3D points with the current scene parameters (projection, transformations, etc). Note that the coordinates are given in pixels relative to the viewport's location, not the computer screen! If you need for further processing, you can access the viewport's dimensions by fetching viewport[0] (xOrigin, relative to the OpenGL window), viewport[1] (yOrigin), viewport[2] (width) and viewport[3] (height).
Initial Title
gluProject command sequence
Initial Tags
Initial Language
C++