Advertisement

Translating 2d coords to 3d

Started by March 18, 2000 10:59 AM
1 comment, last by Metus 24 years, 11 months ago
Can someone help me to translate DirectInput coords so that i can use them in OpenGL?? Since the mouse coords starts at 320,240 (Center of screen) and the OpenGL coords are 0,0 in the centre....os did i misunderstand the whole thing?
Ethereal

Just subtract the amount that''s wrong.
For instance, if 320,240 is 0,0 then just use
xcoord=xcoord-320
ycoord=ycoord-240

I don''t have any opengl experience, but I doubt that one change in mouse coord will represent one pixel in opengl, so you will have to change the updating a bit more.

Or am I missing something important here? Tell so.
(it looks rather simple)



Newbie
/Mankind gave birth to God.
Advertisement
The most important part is that OpenGL has the Y-axis pointing up, where as in DirectX the Y-axis points down.

I''m not sure what it is that you want to do though. Do you want to convert the mousecoordinates into 3D coordinates? If so then you can use glUnproject().

This topic is closed to new replies.

Advertisement