what sometimes bugs me about opengl is that it is not object oriented. but dodn't get me wrong, it is good that it isn't, because this make it easily available to many programming languages. nevertheless I often forget, which constants (GL_xxx) values. further, it's some kind of unstructured, I guess for beginners it really consumes a lot of time, to figure out which methods (glXXX) are somehow related to others and so on..
Threrefore I decided to make some objects wrappers and since every opengl app uses the matrix stack, I thought it was a good idea to start with this one. I tried to encapsulate the whole functionality in the two attached classes: MatrixMode
. (forum doesn't allow .java -> .txt)
Having a look down, you'll notice another MatrixStack class, which extends the first one (same name, different package). This is an example implementation, how to extend the base class for an easy use with a math library. of course I used mine, but a port to yours or javax.vecmath should be straight forward.
Just to note, I didn't focus on performance, but if someone can tell me how to optimize parts easily, then you're welcome
I hope GPL is o.k. for everyone