Skip to main content
gamedev.net
🔒 Locked

gluUnProject()

Started by okapota Oct 17, 2000 at 9:20 AM 2 replies 350+ views
Original Post
okapota
okapota
hi, can u explain me how to use this function, and how to find the third parameter- mousez. thnx.
mitchbb
mitchbb
Okapota,

I think the parameter you''re referring to is actually listed as the winz parameter. It''s a depth range coordinate that is normally set between 0.0 and 1.0, in other words, the near and far clipping planes.

I get the impression, based on your question, that you''re trying to use a mouse cursor to select objects in a 3D space? If you try playing with different values for winz, you''ll notice that the function returns obj z values that become much less precise the closer you set winz to the far clipping plane. I decided to use gluProject() instead for each object in my space and plug the return values into an array representing screen coordinates. That way, my mouse knows what its pointing at I''m sure its not the ideal solution but so far, it seems to work well enough.

Anyway, probably not the answer you were looking for, but maybe it helps a little
okapota
okapota
thnx, but how do i know what value to put in the third parameter, winz?
and my far plane is 70, not 1, if it will be one, i will see nothing.
zedzeek
zedzeek
use glReadPixels(... GL_DEPTH_COMPENT ) to get the depth value of the pixel under the cursor (or whatever) use that as the winz value

http://members.xoom.com/myBollux

Topic Locked

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

Sign in to reply to this topic.