I want to be able to click on the teapot I have drawn in a room. So far, I can't get it to work. Anyone have any tips? This is killing me!
Code:
glPushMatrix();
glColor3fv(BLUE);
glTranslatef(5.0, 0.4, -5.0);
glScaled(0.3, 0.2, 0.3);
//recalcModelPos();
glutSolidTeapot(0.80);
//glutSwapBuffers();
glPopMatrix();
Code:
void mouse(int button, int state, int x, int y)
{
if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
{
mousemotion = 1;
mousex = x;
mousey = y;
}
if(button == GLUT_LEFT_BUTTON && state == GLUT_UP)
{
mousemotion = 0;
}
}
void motion(int x, int y)
{
if(mousemotion)
{
xangle = xangle - (y - mousey);
yangle = yangle - (x - mousex);
mousex = x;
mousey = y;
glutPostRedisplay();
}
}