Ok, anybody know matrix algebra.
Inside gluUnproject the first steps are:
-
__gluMultMatricesd(modelMatrix, projMatrix, finalMatrix);
then
2) if (!__gluInvertMatrixd(finalMatrix, finalMatrix))
return false;
The routine is retunring from 2 with the error:
[quote]No non-zero pivot. The matrix is singular, which shouldn’t
happen. This means the user gave us a bad matrix.here.
[/quote]
Now I have the following inside my display method:
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(fov_y, aspect, near_z, far_z);
/* Save projection matrix for later use */
gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, proj);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
glu.gluLookAt(eye[0], eye[1], -eye[2],
lookat[0], 1f, -lookat[2],
0f, 1f, 0f);
/* Save modelview matrix for later use */
gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, model);
Now here is where i place my unproject function to determine the world coordinates of an x,y screen location, and it retunrs as described above. What is confusing me is that the various objects that I render display ok. I just can’t get the screen coordinates converted to world coordinates.
Any thoughts.