I'm trying to set up an orthographic projection so I can draw a rectangle using screen coordinates, but even if I draw a rectangle using the width/height of the window, it only fills a quarter of the window. Am I doing something wrong with glOrtho?
Relevant code: (width/height refers to window dimensions)
glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0f, width, height, 0.0f, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glTranslatef(0.0f, 0.0f, 0.0f); glBegin(GL_QUADS); glVertex2i(0, 0); glVertex2i(width, 0); glVertex2i(width, height); glVertex2i(0, height); glEnd();
Output looks like this:
I am targeting OpenGL 2.1 if that matters.