glOrtho problem

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

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);

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

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);

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

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 on other sites
I'm almost certain it would draw something, if you were standing on the other side ,-)

Share on other sites
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 on other sites
Yep. It's the winding messing with me. :P

• 33
• 12
• 10
• 9
• 9
• Forum Statistics

• Total Topics
631352
• Total Posts
2999484
×