I'm not an opengl expert, and, as a novice, I prefer to practice a little bit with the old opengl just to be sure to understand correctly the basic concept of computer graphics before deal with shaders and modern opengl (3.x). I don't want to start a flame with this so I'll go through my question. I just know that what I'm using is deprecated.
What I wanto to render is this:
and I'm drawing it using this piece of code:
// draw grid
drawGrid(10, 1);
// draw a teapot
glPushMatrix();
glTranslatef(modelPosition[0], modelPosition[1], modelPosition[2]);
glRotatef(modelAngle[0], 1, 0, 0);
glRotatef(modelAngle[1], 0, 1, 0);
glRotatef(modelAngle[2], 0, 0, 1);
drawAxis(4);
drawTeapot();
glPopMatrix();
Now, I'd like to replace the last glTranslatef
and glRotatef
with matrixes, and I'm doing in this way:
Matrix4 _matrixModel;
_matrixModel.identity();
_matrixModel.translate(modelPosition[0], modelPosition[1], modelPosition[2]);
_matrixModel.rotateX(modelAngle[0]);
_matrixModel.rotateY(modelAngle[1]);
_matrixModel.rotateZ(modelAngle[2]);
glLoadMatrixf(_matrixModel.getTranspose());
And I don't see anymore the teapot. So I thought that this _matrixModel is not complete because it is only the model matrix and I need a modelview so I have to multiply it with the projection matrix but.. this is what I get:
where am I wrong?