B.2. ErrorsAs a general rule, don't place calls to glGetError() in production code. OpenGL errors usually are an indication of a bug in your application that should be resolved during development. Furthermore, calls to glGetError(), although relatively inexpensive, have a nonzero cost, so they shouldn't appear in production code for performance reasons. Finally, OpenGL error semantics are subject to change in future revisions of OpenGL. Although The OpenGL Graphics System and extension specifications define all the conditions that cause an error, an action that causes an error today might not cause an error in the future. If your application depends on certain errors occurring under certain circumstances, your code will break if those errors go away in a future version of OpenGL. In summary, you should test for errors, absolutely; see appendix D, "Troubleshooting and Debugging." But you should not write code that depends on an error for the application to operate correctly. |