I got an OpenGL Context Working in SDL, and I'm trying to set it up so I can render with pixel coordinates of the screen. I got this trying to fill the entire screen with a white rectangle:
glViewport(0, 0, MonitorWidth, MonitorHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, MonitorWidth, MonitorHeight, 0, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1, 1, 1); glBegin(GL_QUADS); glVertex2f(0, 0); glVertex2f(MonitorWidth, 0); glVertex2f(MonitorWidth, MonitorHeight); glVertex2f(0, MonitorHeight); glEnd();
It doesn't work, and the entire screen appears black. What's wrong with this?