glPushMatrix(), glPopMatrix() alternative.

Aparantly the methods:
glPushMatrix(), glPopMatrix()
are depricated.

I was wondering if anyone knew of a good tutorial to explain an alternative to storing the current matrix in an effective way.

I find that im using both depricated methods alot.

If glPushMatrix and glPopMatrix serve you well, you can stick with it. But if the GL matrix stack is not large enough for you (depend on implementation but it is 64 depth in general) then you can implement your own matrix stack with a stl data structure. For matrix operation, you can use glm. Then pass the top of the stack to the function glUniformMatrix4fv for your shader.

In C++, with the stl and glm, the behavior of the “old” GL matrix stack can be implemented with a few lines of code.

Thanx Ill take a look at those libraries.

this might be a silly question, but here goes…

Currently Im only using low level shaders:
GL_ARB_vertex_program
and
GL_ARB_fragment_program

If I was to handle the matrix math myself, what would be the best way to pass the current matrix to the shader?

using 4 calls to glProgramEnvParameter4()
in order to pass 1 4*4 matrix.

or will the low level shaders also become deprecated?

I was hoping to pass the matrix via: glLoadMatrix() but it seems that even that is deprecated.

Currently Im only using low level shaders:

The only reason you should care about what has been removed and what has not is if you’re trying to use GL 3.1 core or greater. If you are using ARB assembly shaders, then you’re using extensions that were written against removed functionality. So there’s really no reason for you to care about core vs. compatiblity; just keep doing things as you have been.

Ok, ill keep doing what I have been doing, except maybe use loadMatrix() instead of push and pop, as I have found it greatly improves perforamnce when accessing OpenGL via Java.

I was just worried my code would become obsolete overnight.

Also I wanted my code to be able to run shaders on low end video cards aswell as high end, without having to make multiple versions.