View changes in 3.3

I’m used to using glFrustum, gluPerspective, glOrtho, gluOrtho2D, etc, however as I’m now trying to learn OpenGL 3.3 (my driver won’t run 4.1), I’m looking at the 3.3 docs and have noticed that none of them (well, of the gl* functions) are there. glFrustum, glOrtho… all gone. If I try to use them in my code, they still compile, but the fact that they’re out of the docs tells me they’re only for legacy purposes. So… what are the new view-based functions for 3.3? And… how do I use them?

If I try to use them in my code, they still compile, but the fact that they’re out of the docs tells me they’re only for legacy purposes.

Just make a compatibility context and be done with it. If you don’t know what that is, then you’re probably already getting one and it’s nothing to be concerned about.

So… what are the new view-based functions for 3.3?

There aren’t any.

All these functions ever did was create matrices using well-understood parameters. OpenGL 3.3 core expects you to be able to do that yourself.

Just google for gluPerspective etc. and you should find pages that show the (pseudo) code how they create the matrices.

Copy&Paste that into your own project and voila you can create those matrices yourself. Then upload them into the shaders and use them as in GL 2.1.

Jan.

Ah, okay. The one good thing I learned in my CG class was all the matrices. Now I just need to dust off that notebook, wherever it is.

But… they go in the shader? That one blind-sided me.

Send the projection matrix as uniform, multiply vertex position by matrix, and you get the projected coordinates.

I suppose it’d be best to send the modelview matrix as well, to deal with any rotations and whatnot?

However, does this mean that I need to call glUniform*() whenever I do a view change?

However, does this mean that I need to call glUniform*() whenever I do a view change?

For each program that uses the appropriate matrices, yes.

Or… you can use GLM (glm.g-truc.net) which implement already all these functions in a very OpenGL fashion.

In the documentation of the next release, the replacement functions are listed:
https://docs.google.com/document/pub?id=1R4H08fWX6MeGJ0N7LqQRLKkQ7Tn2S9yTrXOMYCEEZLI