Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glBegin(GL_QUADS);
- glVertex2f(-1.0,-1.0);
- glVertex2f(1.0,-1.0);
- glVertex2f(1.0, 1.0);
- glVertex2f(-1.0, 1.0);
- glEnd();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- int w = glutGet(GLUT_WINDOW_WIDTH);
- int h = glutGet(GLUT_WINDOW_HEIGHT);
- gluOrtho2D(0, w, h, 0);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
- // Draw your quad here in screen coordinates
- glPopMatrix() // Pops the matrix that we used to draw the quad
- glMatrixMode(GL_PROJECTION);
- glPopMatrix(); // Pops our orthographic projection matrix, which restores the old one
- glMatrixMode(GL_MODELVIEW); // Puts us back into GL_MODELVIEW since this is probably what you want
Add Comment
Please, Sign In to add comment