What tips or tricks do you have when it comes to making the OpenGL more efficient?
The standard tip of profile, profile, profile applies just as well here, although the tools are slightly different.
gDEBugger is great at helping you see exactly what's going on under the hood. It's expensive, though.
These are from Apple's documentation references on OpenGL but every little bit helps right? ;)
(This last one is a sample application)
There are also a very large number of videos available on the subject (Also from Apple) that talk about OpenGL extensions. Some of them are OS X specific, but a few others are more generalized and could most likely be applied to Windows and Linux.
You can find the videos here. You do require iTunes and an Apple account to view them however (but they are free! :D)
Well, it really, really depends on what you're planning to do, but here are the basics:
Your CPU is very precious while your GPU is a hungry beast. Offset as much as you can to the GPU. Nowadays you can do this with excellent libraries like OpenCL, CUDA and Thrust.
Do your lighting in a shader. Not only will this help retain your sanity, but it allows you to very cool things like toon shaders and deferred lighting.
Particles suck. Even when using OpenGL point sprites.
Simple one liner that applies back face culling. This is excellent for trimming down polygon count. Also look into Frustum/Occlusion culling for reducing poly counts.
Another thing to look into is SIMD for your vectors and quaternions (mostly used in camera rotations). If you don't want to mess with ASM then check out libSIMD which is a great library for handling SIMD in C.
Don't use glGet* when you can access local variables, e.g.:
- Don't query textures size from OpenGL, store them on loading in variables
- Don't query line widths / points sizes from OpenGL when you can store the changes in your application
These calls are really slow
Move unused stuff outside of glBegin - glEnd clause (be it glColor or glNormal or anything else) if it does not changes inside. OpenGL is a state machine, it uses the last value.