so basicly i do (in pseudo c):
Draw
{
glPushMatrix;
ApplyTransformation(translate, rotate, world);
Model->Draw;
glPopMatrix;
glPushMatrix;
ApplyTransformation(translate, rotate, world);
ApplyTransformation(translate, rotate, model); // other coords and rotationvectors
Model->Draw;
glPopMatrix;
}
(in ApplyTransform there are rotation and translation calls)
which is build like this:
void Renderer::ApplyTransformation(int rendermode)
{
if (rendermode == RENDERMODE_WORLD)
{
// scale, rotate, translate
glRotatef(cam->rotationX->W, cam->rotationX->X, cam->rotationX->Y, cam->rotationX->Z);
glRotatef(cam->rotationY->W, cam->rotationY->X, cam->rotationY->Y, cam->rotationY->Z);
glRotatef(cam->rotationZ->W, cam->rotationZ->X, cam->rotationZ->Y, cam->rotationZ->Z);
glTranslatef(cam->translation->X, cam->translation->Y, cam->translation->Z);
}
if (rendermode == RENDERMODE_MODEL)
{
glRotatef(model->rotationX->W, model->rotationX->X, model->rotationX->Y, model->rotationX->Z);
glRotatef(model->rotationY->W, model->rotationY->X, model->rotationY->Y, model->rotationY->Z);
glRotatef(model->rotationZ->W, model->rotationZ->X, model->rotationZ->Y, model->rotationZ->Z);
glTranslatef(model->translation->X, model->translation->Y, model->translation->Z);
}
}
did i get it right that now:
the 2nd model is calculated with the “world” coords,too and after that it’s own transformation?
i’m just confused of my self, since in no draw i set matrixMode(GL_MODELVIEW)… only in inits mhmm