Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

glOrtho

Name: Anonymous 2011-08-29 19:11

So I'm learning OpenGL right now and trying to use glOrtho to scale my sprites correctly, but it doesn't seem to be working. No matter what arguments I pass to glOrtho, it always defaults back to (-1, 1, -1, 1). I checked for GL errors and got nothing. Here is my test code:

void Draw() {
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-100.0, 100.0, -100.0, 100.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glLoadIdentity();
    glBegin(GL_QUADS);
        glColor3f(1.0f, 0.0f, 0.0f);
        glVertex2f(-1.0f, 1.0f);
        glVertex2f(1.0f, 1.0f);
        glVertex2f(1.0f, -1.0f);
        glVertex2f(-1.0f, -1.0f);
    glEnd();
}

The quad I draw should be tiny, but it covers the entire viewport. Halp!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List