Must create window in same function as glutInit?

I was trying to get this big list of opengl setup out of my main(), so I thought I’d put it in a couple of functions.

int MainWindow(string WindowTitle)




void OpenGLinit(int argc, char *argv[])


	glutInit(&argc, argv);

	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);

	glutInitWindowSize(1000, 1000);


	//MainWindow(1000, 1000, "test");



If I call OpenGLinit() from main with the MainWindow() call uncommented, all is well.

However, if I call OpenGLinit() from main, and then MainWindow() from main, I just get a black window with none of my objects drawn!! Doesn’t make any sense to me - does any one have an explanation?