Jump to content
  • Advertisement
Sign in to follow this  
FireDK

OpenGL glutGameMode Problem

This topic is 3601 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. I'm trying to make an OpenGL game but I ran into a problem. Whenever I start the application, the color depth is always 8 bit (it doesn't matter what I request with glutGameModeString) and I cannot get over 5 FPS - it feels like it's software rendering or ever worse. I have no idea why this happens and I could really use some help. Thank a lot. This is my main() function:
int main(int argc, char** argv) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);

	glutGameModeString("width=1024;height=768;bpp=32;");

	if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) {
		glutEnterGameMode();
		printf("%d", glutGameModeGet(GLUT_GAME_MODE_PIXEL_DEPTH));
	} else {
		exit(1);
	}

	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

	glShadeModel(GL_SMOOTH);

	glEnable(GL_DEPTH_TEST);
	glEnable(GL_TEXTURE_2D);

	glutReshapeFunc(resize);
	glutDisplayFunc(display);
	glutIdleFunc(idle);
	atexit(atexit);

	Keyboard.Init();
	Mouse.Init();

	Map.Init("data\\maps\\floor.map", "data\\maps\\walls.map", "data\\maps\\ceiling.map", "data\\textures\\floor.png", "data\\textures\\wall.png", "data\\textures\\ceiling.png");

//	Camera.SetCamera(11.0f, 1.5f, 6.0f, 16.0f, 1.5f, 16.0f, 0.0f, 1.0f, 0.0f);
	Camera.SetCamera(0.0f, 1.5f, 0.0f, 6.0f, 1.5f, 6.0f, 0.0f, 1.0f, 0.0f);

	glutMainLoop();

	return 0;
}

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by FireDK
glutGameModeString("width=1024;height=768;bpp=32;");
The mode string uses spaces or tabs as separators, not semi-colons, so the string should be "width=1024 height=768 bpp=32". Alternatively, you can use the compact representation, in which case the mode string would be "1024x768:32".

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Quote:
Original post by FireDK
glutGameModeString("width=1024;height=768;bpp=32;");
The mode string uses spaces or tabs as separators, not semi-colons, so the string should be "width=1024 height=768 bpp=32".


This works. Thank you very much.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!