This question has coding components to it, but mostly it's just a math question.
In C++ using OpenGL, I have a system set up where you can easily add vertices to a single buffer and draw them. The main issue with this is that I can't easily change the model matrix in order to rotate these vertices. I thought the approach that would be the best for performance would be to manually rotate the vertices before they go into a buffer. The problem is, I don't know how to go about doing this.
Right now, I have a cube class that takes a position, size, and rotation. Currently, it computes the 8 vertices by taking the position +/- size / 2. This gets a Minecraft like cube. I would've assumed I could rotate this cube doing something as simple as position.x + (size.x / 2 * sin(rotation.x)), but this hasn't seemed to work. I'm assuming there is a much more elegant approach to this.
I've seen many questions similar to this, but they all use immediate mode OpenGL, where you can specify things like glRotatef() and it does all the work for you.
Any help would be very much appreciated, thanks.