Advertisement Jump to content
Sign in to follow this  
InetRoadkill

glOrtho problem

This topic is 3863 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

This is driving me nuts. I'm sure I'm just overlooking something stupid. I want to flip the y coordinates in an ortho view to make life easier merging images from Gimp so that the coordinate systems match. This works, but y is upside down:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0, m_width, 0, m_height, -1.0, 1.0);

glBegin(GL_QUADS);
glVertex2f(x,y);
glVertex2f(x+width, y);
glVertex2f(x+width, y+height);
glVertex2f(x, y+height);
glEnd();
This doesn't draw anything:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0, m_width, m_height, 0, -1.0, 1.0);

glBegin(GL_QUADS);
glVertex2f(x,y);
glVertex2f(x+width, y);
glVertex2f(x+width, y+height);
glVertex2f(x, y+height);
glEnd();
If I understand the matrix transforms correctly, the second example should flip the image vertically. What am I overlooking?

Share this post


Link to post
Share on other sites
Advertisement
This means: change the winding of the quad (just change the order of the vertices from 0, 1, 2, 3 to 0, 3, 2, 1), change the definition of front faces (i.e. CW-winding instead of CCW-winding) or disable backface culling as a whole.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!