I'm working on a sketchpad project for school and need to be able to have the mouse coordinates correspond to screen coordinates, even if the window is resized. I'm using glut and my current resize function is:
Code:
void resizeISR(int _w, int _h) {
	int initw = glutGet(GLUT_INIT_WINDOW_WIDTH), 
		inith = glutGet(GLUT_INIT_WINDOW_HEIGHT),
		w = glutGet(GLUT_WINDOW_WIDTH),
		h = glutGet(GLUT_WINDOW_HEIGHT);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0,w,0,h);
	glScalef(float(w)/float(initw),-1*float(h)/float(inith),1);
	glTranslatef(0,-h,0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
This works fine, except that when I make the window bigger, I can see the area that is uncovered but I can't draw on it. I think that this is because glutOrtho2D is clipping off everything that it doesn't think is in the window. Is there some way to stop this from happening, or do I need to figure out how to set up the projection matrix manually?