Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

slow render speed on mac mini



I've been trying to figure out what I may not be setting up correctly with
OpenGL. I'm drawing only about 7 texture mapped rectangles (triangle fans,
aligned to the screen, so it looks like 2D UI). 1024x768 window. Not all the
images are that large. The total is about 3 million pixels drawn each frame.
On the Mac Mini, I'm getting about 20 frames per second. This is really
slow. On the PC, using OpenGL, the frame rate is over 100 FPS.

Running OpenGL Profiler shows most of the time spent in CGLFlushDrawable.
I've checked for any gl errors and there are none.

Has anyone else noticed problems like this with OpenGL on the Mac? Is it the
mini?

Here's some psuedo code of my initial setup of OpenGL, using glut, and the
update loop.

I'm really desparate to figure this out (deadline approaching).

Thanks for any help.

----------------------------------------------------------

initial setup:

	glutInit(&argc, argv);

	glutInitDisplayString("rgba double depth=16");

	int stat = glutGet(GLUT_DISPLAY_MODE_POSSIBLE);

	if (mFullScreen)
	{
		glutGameModeString("1024x768:32");
		glutEnterGameMode();
	}
	else
	{
		glutInitWindowSize(1024, 768);
		glutCreateWindow(appName);
	}

	glShadeModel(GL_SMOOTH);

	glClearDepth(1.0f);

	glDepthFunc(GL_LEQUAL);

	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

	glEnable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glEnable(GL_CULL_FACE);

	glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

	// Setup and enable light 0
	GLfloat ambientLight[] = { 0.3f, 0.3f, 0.3f, 1.0f };
	GLfloat diffuseLight[] = { 0.7f, 0.7f, 0.7f, 1.0f };
	glLightfv(GL_LIGHT0, GL_AMBIENT, ambientLight);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseLight);
	glEnable(GL_LIGHT0);

	// Enable color tracking
	glEnable(GL_COLOR_MATERIAL);

	glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE,
GL_STORAGE_SHARED_APPLE);

	glutKeyboardFunc(macKeyEvent);

	glutMouseFunc(macMouseButtonEvent);

	glutPassiveMotionFunc(macMouseMoveEvent);

	glutMotionFunc(macMouseDragEvent);

	glutDisplayFunc(macUpdate);

	glutIdleFunc(macUpdate);

	glutMainLoop();

update loop:

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glFrontFace(GL_CCW);

	glEnable(GL_LIGHTING);

	glEnable(GL_DEPTH_TEST);

	glMatrixMode(GL_PROJECTION);

	glPushMatrix();

	glLoadMatrixf(mat);

	glMatrixMode(GL_MODELVIEW);

	glLoadMatrixf(mat);

	glDisable(GL_LIGHTING);

	glDisable(GL_DEPTH_TEST);

	glMatrixMode(GL_TEXTURE);

	glLoadIdentity();

	glMatrixMode(GL_MODELVIEW);

	glMatrixMode(GL_PROJECTION);

	glPopMatrix();

	glMatrixMode(GL_MODELVIEW);

	glPushMatrix();

	glLoadIdentity();

	glTranslatef(-screenWidth * .5, -screenHeight * .5, -dist);

	for each quad:
		glBindTexture(GL_TEXTURE_2D, id);

		glBegin(GL_TRIANGLE_FAN);

		for (int i=0; i<4; ++i)
		{
			glColor4f(r, g, b, a);

			glTexCoord2f(verts[i].tu, verts[i].tv);

			glVertex3f(verts[i].sx, verts[i].sy, -verts[i].sz);
		}
		glEnd();


	glPopMatrix();

	glutSwapBuffers();

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 266.11.17 - Release Date: 5/25/2005

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.