You shouldn't need a "stack" at all.
You should have a single "drawable" type (you generally do not need more than one; variations on a request to draw are data and individual game entities should not draw themselves). The
Drawable type contains:
- A reference to the geometry being drawn.
- A reference to the shader program used to draw.
- References to any textures needed by the prior two items.
- A matrix storing the object's world transformation.
(The references are key to avoid data duplication and to allow for sorting by these objects prior to rendering when possible, since that helps minimize state changes and improve rendering performance.)
To handle a transformation like the camera, store the camera's viewing transformation in a
Camera object that represents the camera.
To handle actual world transformations applied to multiple objects, such as supporting the bulk selection and moving of many entities, you'll probably want a higher-level system. This is generally not the domain of the renderer itself. Something that can maintain the collection of grouped objects and apply a requested transformation to their existing transformations (for example, a
Selection type if all you're doing is selection-related stuff).
A scene graph is occasionally useful for that kind of thing, though you should proceed with caution there as scene graphs tend to create black holes of over-engineering and design paralysis.