O'Reilly logo

OpenGL Distilled by Paul Martz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Best Practices

This appendix includes OpenGL programming tips designed to improve code reusability and reduce application bugs. Some topics covered will also help improve application performance, but for more performance information, see Appendix C, “Performance.”

B.1 State

OpenGL is a state machine, and when your application puts OpenGL in a certain state, OpenGL stays in that state until code changes it to another state. Often, this is the behavior you want. Many applications typically enable depth testing with glEnable ( GL_DEPTH_TEST ) at init time, for example, and leave it enabled for the duration of their program execution.

If state isn’t set the way you want it, however, OpenGL probably won’t produce the results you want. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required