Reputation: 3955
Old fixed-pipeline OpenGL programming made heavy use of the matrix stack principle.
With flexible shaders I'm now free to create and use my own matrices as I like. I've read tutorials that don't seem to use any kind of matrix stack anymore, instead just saving and applying the necessary matrices as needed.
Others, like this one, seem to use a matrix stack library for all of their matrices (see the example code in the linked chapter).
My question is: Is this a purely arbitrary preference, or is one or the other way preferred with modern graphics programming?
Upvotes: 0
Views: 411
Reputation: 473407
How you generate your matrix data is more or less irrelevant. In very high-performance scenarios, one solution might be preferred over another, but it would ultimately be very engine specific.
If you want to use the C++ stack to have a hierarchy of objects, so be it. If you want to have an explicit stack of matrices that you push/pop at will, have at it. If you want to do something else entirely, that's up to you.
There is no right answer; there is only what works best for you and your code.
Upvotes: 1