I invested some time today to fix a long standing feature enhancement: in-place matrix operations. What’s that? OpenGL ES 1.x (and desktop OpenGL) have a rather convenient way of concatenating matrix operations:
glTranslate(10, 10, 10);
glScale(1, 2, 1);
glRotate(45, 0, 0, 1);
These functions operate on the top of the currently active matrix stack of OpenGL. The transformations are applied from bottom to top (rotate, scale then translate in the above example).
Doing something like this with Matrix3 and Matrix4 was a bit of a piece in the ass until now as one had to use a temporary matrix to achieve the same. I went ahead and implemented three new methods on Matrix3 and Matrix4: rotate, scale and translate. These will post-multiply the matrix with a rotation, scaling or translation matrix, in-place. No need for a temporary matrix anymore. Furthermore, the methods return a reference to the matrix so you can easily chain transformations.
In addition to that i wrote a little class called ShapeRenderer which allows you to draw points, lines, (filled) rectangles, and boxes. The class is meant to support you while debugging and follows the batching paradigmn we have in a lot of our graphics classes. It’s actually not terribly slow, but i’d still not recommend using it in production.
You can find the code that produces the above output here. I put a bit of effort in the javadocs of the class as well. This is how i want all our javadocs to look like in the near future, maybe you can give me feedback if it’s good enough.