Skip to main content
gamedev.net
🔒 Locked

Depth Buffer Trouble

Started by Jo 0 replies 200+ views
Original Post
Jo
Jo
I''m using gluUnProject to find the object coords of a given pixel on the screen, using the x and y coords of a mouse cursor and the z element from the depth buffer. As it happens my call to glReadPixels simply isn''t returning a value which in turn throws off the subsequent call to glUnProject. Here''s the actual call: glReadPixels ( mouseXpos, mouseYpos, 1, 1, GL_DEPTH_COMPONENT, GL_DOUBLE, &mouseZpos ); As a special note I have enabled GL_LEQUAL depth testing (although I toggle it on and off to draw my interface with blending - I only turn it off after I try to make the call above). This one has me stumped, since the procedure is pretty straightforward. ----------------------------- Mice are an excellent source of mice.
-----------------------------Mice are an excellent source of mice.
Jo
Jo
Ha. Well never mind.

Despite the fact that the line above is almost verbatum from the OpenGL FAQ from http://www.opengl.org it turns out that glReadPixels won''t accept a glEnum for doubles, only floats.

At least I wasted a lot of time.

-----------------------------
Mice are an excellent source of mice.
-----------------------------Mice are an excellent source of mice.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.