from feedback buffer i got the xMax, xMin, yMax
yMin,zMax, zMin values
I want to use gluUnproject to turn them into 3D coordinate, but i failed!the result is not right!
gluUnProject((GLdouble)m_xMin,
(GLdouble)m_yMin,
(GLdouble)m_zMax,
dModelMatrix,
dProjMatrix,
iViewPort,
&ObjectX,
&ObjectY,
&ObjectZ);
???
i use the glutLookAt function in my program!
is there any thing about it?
that gluUnproject function will ham-string you if youre not careful. mainly, watch the screen-z (non-linear) and viewport-y (reversed):
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
gluUnProject(
screen_x, // screen x
viewport[3]-1-screen_y,// flip screen y
screen_z, // between 0.0 and 1.0
dModelMatrix, // model matrix
dProjMatrix, // projection matrix
viewport, // viewport
&ObjectX, // world x
&ObjectY, // world y
&ObjectZ // world z
);