Archived

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

2D blitting with perspective mode

This topic is 5529 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve written this library that uses OpenGL to do 2D blitting style stuff, but its in orthogonal stuff. Now I want to leave OpenGL in perspective mode, but now I''m having trouble doing the old blitting stuff. The old version used Vertex3i() to place the vertexes. Now whatever is blitted is way too big and not in the right place. I can change the Z coord of all the vertexes, which used to be 0, to something kinda low (-200) and it looks almost the right size, but still not in the right place. How do I figure out how to translate 0,0 in screen coords to 3D OpenGL perspective coords?

Share this post


Link to post
Share on other sites
Ah, ok! Very handy function.

But one problem, the Y''s are messed up. My screen coords are (0,0) is the top left and (maxx, maxy) are the bottom right. glUnProject() is making y decrease as it goes down, 0 being at the bottom of the screen.

Is it supposed to do that? Do I need to compensate the Y values? Or is there a problem with my code?

Share this post


Link to post
Share on other sites