Hi,
I am getting a little frustrated. When I change the size of the window in my application the raster position moves so when a draw to the screen (glDrawPixels)
it draws them in the wrong place i.e. not at the bottom left of the window which it does before any window resizing. How can I keep its position in the lower left corner ?
Any help would be welcom
Thanks
Paul
Try this:
RECT rect; int heightClient; int widthClient; GetClientRect(hwnd, &rect); widthClient = rect.right - rect.left; heightClient = rect.bottom - rect.top; glViewport(0, 0, widthClient, heightClient); glMatrixMode(GL_PROJECTION); glPushMatrix(); // Setup viewport aligned projection glLoadIdentity(); glOrtho(0.0, (GLdouble) widthClient, 0.0, (GLdouble) heightClient, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glRasterPos2i(0, 0); glDrawPixels(widthClient, heightClient, GL_RGBA, GL_UNSIGNED_BYTE, buffer); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix();