PDA

View Full Version : Is it OK ?



jirkamelich
12-10-2002, 10:33 AM
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;
glGetDoublev(GL_MODELVIEW_MATRIX,&ModelViewMatrix);
GLdouble ProjectionMatrix;
glGetDoublev(GL_PROJECTION_MATRIX,&ProjectionMatrix);
GLint ViewPort;
glGetIntegerv(GL_VIEWPORT,&ViewPort);
gluUnProject(Myska.Xpos,Myska.Ypos,1.0,ModelViewMa trix,ProjectionMatrix,ViewPort,&ObjX,&ObjY,&ObjZ);

Bob
12-10-2002, 02:41 PM
Define your variables like this instead.



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

jirkamelich
12-11-2002, 07:39 AM
it works, but kind of wierd i think. The number which i get are not ok. Can somebody help me ?

Bob
12-11-2002, 09:12 AM
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.

jirkamelich
12-11-2002, 10:26 AM
i would like to get position of mouse pointer in opengl scene (x,y,z)

jirkamelich
12-11-2002, 11:08 AM
Originally posted by jirkamelich:
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.