In advance, thank you for any and all help! Basically all I want to do is be able to ‘create’ up to 5 Teapots whilst running, and control each of them separately. The code I’ve got so far lets me create one, and control it, but creating a second just replaces the first. Again, thank you for any help!
void display(void)
{
glPushMatrix();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gluLookAt(zoomx,zoomy,5, 0,0,0, 0,1,0);
glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective (40.0*zoomz, 1, 0.1, 20);
glMatrixMode(GL_MODELVIEW);
mat_shininess[0] = shiny;
mat_specular[0] = specx;
mat_specular[1] = specy;
mat_specular[2] = specz;
mat_specular[3] = specj;
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
if(Teapots==1){
TeapotOne();
}
if(Teapots==2){
TeapotTwo();
}
if(type2!=0)glShadeModel(type2);
glPolygonMode(GL_FRONT_AND_BACK, type);
glPopMatrix();
glutSwapBuffers();
}
void TeapotOne(){
if(selected==1){
glTranslatef(tranx ,trany,tranz);
glRotatef(rotatex,0,1.0,0);
glRotatef(rotatey,1.0,0,0);
glRotatef(rotatez,0,0,1.0);
glScalef(scalx, scaly, scalz);
}
glutSolidTeapot(0.5);
}
void TeapotTwo(){
if(selected==2){
glTranslatef(tranx ,trany,tranz);
glRotatef(rotatex,0,1.0,0);
glRotatef(rotatey,1.0,0,0);
glRotatef(rotatez,0,0,1.0);
glScalef(scalx, scaly, scalz);
}
glutSolidTeapot(0.5);
}