Archived

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

BradDaBug

2D blitting with perspective mode

Recommended Posts

BradDaBug    913
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
BradDaBug    913
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