Is it OK ?

I’m trying to use gluUnProject, can somebody tell me, if the following source code should work ? I tryed on my computer, but it kind of froze, i don’t know if it is my win or the bad source code. Myska is type GLdouble.

GLdouble ObjX;
GLdouble ObjY;
GLdouble ObjZ;
GLdouble ModelViewMatrix;
GLdouble ProjectionMatrix;
GLint ViewPort;

Define your variables like this instead.

GLdouble ModelViewMatrix[16];
GLdouble ProjectionMatrix[16];
GLint ViewPort[4];

it works, but kind of wierd i think. The number which i get are not ok. Can somebody help me ?

The numbers you get are correct with respect to what you pass, there’s nothing wrong with gluUnProject. I would say you don’t know what you get from it, or don’t know what to pass to it to get what you want.

Tell us what you want and maybe we can help more.

i would like to get position of mouse pointer in opengl scene (x,y,z)

Originally posted by jirkamelich:
[b]i would like to get position of mouse pointer in opengl scene (x,y,z)

do you know some good tutorial about gluUnProject ? I read some old questions abouit gluUnProject, and i think that it’s quite difficult to get the gluUnProject work.