I’m new to this group and this may have been asked and answered many times.
Given a point (x,y,z) in space, how can you determine what it’s pixel value will be on the screen in opengl? That is, is there a function that will somehow return its pixel position?
GLdouble x, y, z;
GLdouble mm, pm;
GLdouble wx, wy, wz;
gluProject(x, y, z, mm, pm, vp, &wx, &wy, &wz)
first you get the current modelview-/projection-/viewport-matrices, then you use gluProject with the real coordinates (x, y, z). the window coordinates are returned in (wx, wy, wz).
ATTENTION: for opengl, window coordinates wx=0, wy=0 are the BOTTOM left corner of the window, NOT the top left.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.