C.2. Avoid Software RenderingOpenGL doesn't guarantee hardware acceleration. Even on platforms that allow the application to request hardware-accelerated pixel formats specifically, such as Apple Mac OS X and Microsoft Windows, OpenGL may fall back to software processing if the hardware is incapable of rendering geometry with the current state settings. Furthermore, OpenGL doesn't provide a direct mechanism to query how effectively your application is utilizing graphics hardware. If your application is using full software rendering, performance will vary depending on the type of rendering operations your application performs but in general will be unacceptably slow. This is usually caused by a system configuration problem or a nonaccelerated pixel format. The following tips will help ensure that your application uses hardware acceleration:
OpenGL implementations can use software, or a combination of hardware and software, if the underlying hardware can't fully support application commands for any reason. Given the maturity of OpenGL, this is much less of a concern when using modern OpenGL hardware than it was with earlier devices but is still a concern for the very latest features. Again, OpenGL provides no direct mechanism to query for this situation. To identify commands or groups of commands that might not be accelerated, take timing measurements around suspicious blocks of code, or use one of several third-party software performance tools to identify slow blocks of code. When you've identified commands that take exceptionally long to execute, experiment with OpenGL state settings or command parameters. You might try the following:
These are just suggestions to get you started. The general idea is to tinker with the code until you find a way to eliminate or minimize the performance hit. Providing general solutions for this type of problem is impossible, because the reasons it can occur are innumerable and vary from one OpenGL implementation to the next. In conclusion, often, the question of whether application commands are fully hardware accelerated is irrelevant. More important, you must ask, "Is it fast enough?" |