Advertisement

mouse coordinats

Started by January 17, 2006 09:08 AM
3 comments, last by levjs 18 years, 7 months ago
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
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.
Advertisement
i'm sorry but i am not an expert or anything.
can u tell\show me what i have to do?
thanks.
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
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

This topic is closed to new replies.

Advertisement