Archived

This topic is now archived and is closed to further replies.

waterLINK

Not only picking

Recommended Posts

Hi all!!!!!! Just without painting anything, I would like to know how to convert this things: - A 2D Windows window coordinate to a 3D world space perspective projection openGL view, prepared to render in the window where I take the 2D cordinate (the same window). Just 2D to 3D in perspective. - A 2D Windows window coordinate to a 2D world space orthographic projection openGL view, prepared to render in the window where I take the 2D coordinate. Just 2D to 3D in ortho. I thanks some code, URL, comment, tutorial in advance. Hi. My mind is similar to yours, but I know where you are.

Share this post


Link to post
Share on other sites
just a note on 2d porjections sence there is not any projection.
if you make the ortho display have the same size as window then the window and 2d ortho cords match.

also another thing you may want to look into is GluProject and GLuUnProject ( I forgot the cases for the letters , they could be right or wrong )

Share this post


Link to post
Share on other sites
Hi!

Xero-X2: I have a view, prepared with glOrtho. Perhaps no weel done, I do it this way:

glOrtho(-m_zoom,m_zoom,
(window_height/window_width) * -m_zoom,
(window_height/window_width) * m_zoom,
-200.0f,
200.0f);

If I change m_zoom, due to a mouse movement, I do a zoom effect. But now I don''t if its correrect, and if doing this I lose the matching between Windows screen 2D, and openGL.


Hi.
My mind is similar to yours, but I know where you are.

Share this post


Link to post
Share on other sites
Of course if you wanted to you could use some simple math to do the conversion. I belive it something like this :

zoomedMouseX=(MouseX/windowsizeX * (orthoXRside-orthoXLside))+orthoXLside;

zoomedMousY=(MouseY/windowsizeY * (orthoYBside-orthoYTside))+orthoYTside;

Share this post


Link to post
Share on other sites