Skip to main content
gamedev.net
🔒 Locked

Multi-WIndows Problem!!

Started by koalacui Sep 26, 2005 at 12:49 AM 3 replies 1k views
Original Post
koalacui
koalacui
Sorry for i keep asking questions, but i am really new in OpenGL, so hope everyone can help me out!! really confused, this time is multi windows, I want to create a welcome screen, and game screen, and game over window, but i create two windows, cannot run, the error is "Fatal Error in : redisplay needed for winodw 1, but no display callback", i dont know how to do that, can anybody help me or give me some hints, can teach me the simplest way to create multi-windows??? thanks a lot and best regards!! this is my code!!

void main(void)
{
	INIT_LIB();

	glutInitDisplayMode(GLUT_DOUBLE| GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(640, 480);
	glutCreateWindow("Welcome");
	glutFullScreen();

	glutInitDisplayMode(GLUT_DOUBLE| GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize(640, 480);
	glutCreateWindow("Dodger");
	//glutFullScreen();
	glutSetCursor(GLUT_CURSOR_NONE);
	glutDisplayFunc(RenderScene);
	glutReshapeFunc(Rescale);
	glutIdleFunc(DoMainLoop);

	gameworld = new GameWorld();

	SetupRC();
	SetupLights();
	glutMainLoop();

	SHUTDOWN_LIB();
}


-=[LOVE always, LIVE forever]=-
Ro_Akira
Ro_Akira
Just to clarify, is your intention to first show a Welcome screen, then when user chooses to continue, stop displaying the Welcome screen, and then start rendering the game. Then when the user is finished the game one way or the other, it stops rendering the game, and shows the Game Over screen? If so, creating multiple windows is probably not what you want to do.
koalacui
koalacui
i get it ......emmmm....sorry to trouble u....but can give me some sample code to show that.....i am not familiar with that...thanks !! i really have no idea about create multi windows, can give me some code??
-=[LOVE always, LIVE forever]=-
Ro_Akira
Ro_Akira
// Global program stateenum ProgramState {PS_WELCOME, PS_IN_GAME, PS_GAME_OVER};ProgramState current_program_state = PS_WELCOME; // Program starts at Welcome screen...// Only create one windowglutInitDisplayMode(GLUT_DOUBLE| GLUT_RGB | GLUT_DEPTH);glutInitWindowSize(640, 480);glutCreateWindow("My game");glutFullScreen();glutSetCursor(GLUT_CURSOR_NONE);glutDisplayFunc(RenderScene);glutReshapeFunc(Rescale);glutIdleFunc(DoMainLoop);..etc.void DoMainLoop (){	switch (current_program_state)	{		case PS_WELCOME:			// Welcome screen			RenderWelcomeScreenToWindow ();			break;		case PS_IN_GAME:			// Render game			RenderGameToWindow ();			break;		case PS_GAME_OVER:			// Game Over screen			RenderGameOverScreenToWindow ();			break;		default:			break;	}}

How about something like that? This is relying on my memory serving me correctly, in that the function handed to glutIdleFunc is called repeatedly.
koalacui
koalacui
oooo....thank you so much for that......thanks..thanks...so kind of u..^^
-=[LOVE always, LIVE forever]=-

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.