Skip to main content
GameDev.net gamedev.net
🔒 Locked

mouse coordinats

Started by mc30900 Jan 17, 2006 at 9:08 AM 3 replies 750+ views
Original Post
mc30900
mc30900
hello all. i'm trying to write some kind of a game and i have some problom with the mouse cords. i want that somthing will happen if i press some quad (the quad is never at same place for long). and i have no idea how to translate the mouse cords to the cords of X,Y,Z in my game so i cant cheack if it real pressed. anyone has any idea or suggestion how to solve this? thanks in advance
SiCrane
SiCrane
If you enable the depth buffer, you can use the depth information plus the mouse coordinates as inputs to gluUnproject() to determine the logical coordinates of the mouse click.
mc30900
mc30900
i'm sorry but i am not an expert or anything.
can u tell\show me what i have to do?
thanks.
mc30900
mc30900
i was looking a bit about that function you wrote to me.
i found out that its structure is
int gluUnProject(
GLdouble winx,
GLdouble winy,
GLdouble winz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *objx,
GLdouble *objy,
GLdouble *objz
);

but how do i get the
objx
objy
objz
after i enter the stuff i needed
and how do i use this function?
thanks in advance
levjs
levjs
Hey,
Try taking a look at tutorial 32. Especially the function selection that is called whenever the mouse is clicked. If this doesn't help, I'll give you some code.
Levi

Topic Locked

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

Sign in to reply to this topic.