I do realize that glPush/Pop matrix functions are not supported by many platforms (so don’t shoot me) but does anyone knows how should I replace them without breaking my existing code base?
I do realize that glPush/Pop matrix functions are not supported by many platforms (so
Share
Since these funcs are deprecated along with fixed function on many platforms and new core versions, you have to supply the matrices to your own shader (mandatory) as uniforms.
gl_ModelViewMatrix,gl_ModelViewProjectionMatrixand other builtin uniforms are removed from GLSL along with fixed function in all new OpenGL (core) versions aswell, regardless the platform.Therefore, the decision should not be based on platforms, since all new core profiles don’t have those functions anymore. Replacing this requires some effort, but will improve portability to all platforms and more importantly, (forward) compatibility to the new ones.
Implementing a client side matrix stack is not that hard either.
EDIT: See this C++ example template, which mimicks the OpenGL matrix stack. It lacks the matrix math implementations, does not use the STL stack due to reasons not visible here, but shows the math operations to be done:
EDIT 2: added error check (1 element is the minimum stack size)