I’m rendering a bunch of quads all at different rotations and translations. I’m trying to do all of this in one call the glBegin(GL_QUADS) and glEnd(). Since glRotatef() and glTranslatef() cannot be called within a glBegin() and glEnd() I was hoping to do all the math myself. Since I’m not 100% with matrices, I figured I’d do trigonometry. Here is what I have so far:

That works of one rotation(Z axis). I’ve been trying to implement the two other axes, but I keep getting weird results. So I was hoping someone had done something like this before, however searches on this forum and Google haven’t turned up anything. So if someone could help me with the trig that would be awesome! I figured it wouldn’t be that hard, for the Y axis I would do the same thing I did with the Z axis but instead of doing anything to the Y’s I’d do that part to the Z’s (and change from zrad to yrad) and do the same for X. But again I keep getting very strange results. After a few days of this I figured I’d ask for help, it’s getting hard to stay sane!!!

Then create a matrix (based on rotation, scale, or translation), then a vector based on my position, and finally do the multiplication to figure out the coordinates?

So far what I posted above works (I haven’t had time to test in OpenGL, but using simple inputs in a console window and checking the results seems to work). The only real benefit I had from making the classes myself was re-teaching myself how matrices work. A little later I’ll implement this into my project to verify everything above is working right.

I agree, however making your own class to handle this stuff helps you get a good understanding of how matrix transformations work…at least it did for me.