OpenGL: Implementing transformation matrix stack

opengl

Solution

(it was removed for some reason)

It was removed, because in modern 3D applications the whole OpenGL matrix manipulation functionality was highly redundant. Any modern 3D application needs to deal with matrices anyway, and since OpenGL is not a proper matrix math library you'd use something like Eigen oder GSL or something homebrewn anyway.

A stack is still a very viable structure.

Problem

In a newer OpenGL there is no matrix stack. I am working on a simple display engine, and I am going to implement the transformation stack. What is a common strategy here? Should I build a push/pop stack, and use it with a tree representing my model? I suppose this is the "old" approach, that was deprecated in the newer OpenGL versions. Maybe then it is not the best solution (it was removed for some reason, unknown to me)

Original source