PDA

View Full Version : How to use gluUnproject in 4 openGL windows



sodx
06-20-2003, 12:10 PM
could anyone help me on gluUnproject?
I have an application whic displays 4 openGL windows and each of them are displaying different view of the 3D scenery.One of the four window is the main windows.How can I apply gluUnproject to get the coordinates of the 3D scenery plus i am using MFC+openGL for the application.

john
06-20-2003, 09:50 PM
What part of calling procedures do you not understand?

sodx
06-20-2003, 10:16 PM
i have used the gluUnproject to get the relative coordinates of the 3d world by detecting the mouse coordinates of the screen. the application that i am developing now have 4 opengl windows + an interface. it seems that it detects all the position of the mouse although i click on the interface of the application.what i want is when i click on the opengl windows then it will detect the coordinates of the screen and also the relative coordinates of the 3d world/scenery (the function gluUnproject is activated by mouse click). the the return value of the gluUnproject is so suspicious although i know that i click on (x = 0, y = 0).so could anyone help me

john
06-20-2003, 11:45 PM
I'm having trouble understanding the question. I suspect your question is a combination of geometry and how to do event handling with MFC. Could you elaborate on:


it seems that it detects all the position of the mouse although i click on the interface of the application.

what does "all the position of the mouse" mean? Do you mean you're getting four events raised when you click once, one event per window?


what i want is when i click on the opengl windows then it will detect the coordinates of the screen...

you mean; the co-ordinates of the *mouse relative to the screen*, yes?


... and also the relative coordinates of the 3d world/scenery (the function gluUnproject is activated by mouse click).

relative coordinates of what, to what?

Is your problem that you're getting four events and you want to filter the events so y ou get one event per click? That's a MFC question. I'm sure someone here programs with MFC.

Or, do you mean, you want to compute a 3D vector by inverse projection of one window, and then computing a transformation of that vector to the other windows?

sodx
06-22-2003, 04:47 PM
sorry for the bad wordings:

it seems that it detects all the position of the mouse although i click on the interface of the application.

-->i want to detect the only the opengl windows which means that if the user click on the opengl window then it will return the coordinates...only the opengl window not the interface...how this could be

so...how could i get the 3d coordinates (3d scenery coordinates) using the gluUnProject because i want to draw something when i click to the opengl screen (the position of the "something" is according to the value that received from the gluUnProject)....

could you help me...this application is based on OpenGL for the engine and MFC for the interface......