1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
void drawCow()
{
if (frame == 0) //ne passe que la premiere fois ici
{
cow = new WaveFrontOBJ( "C:/cow.obj" );
cowID = glGenLists(1);
glNewList(cowID, GL_COMPILE);
cow->Draw();
glEndList();
glPushMatrix();
glLoadIdentity();
glTranslated(0,-cow->bbmin.y,-8);
glRotated(-90, 0, 1, 0);
glGetDoublev(GL_MODELVIEW_MATRIX, cow2wld.matrix());
wld2cow = cow2wld.inverse();
glPopMatrix();
}
glPushMatrix();
glMultMatrixd(cow2wld.matrix());
if(active_object == 32) // quand cet objet est sélectionné
glTranslated(Xmouse_2,0,Zmouse_2);
if (selectMode == 0)
{
drawFrame(5);
float frontColor[] = {0.8, 0.2, 0.9, 1.0};
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT, GL_AMBIENT, frontColor);
glMaterialfv(GL_FRONT, GL_DIFFUSE, frontColor);
}
else
{
double r,g,b;
glDisable(GL_LIGHTING);
munge(32, r,g,b );
glColor3d(r, g, b);
}
glCallList(cowID);
glPopMatrix();
} |
Partager