Is glutMouseFunc using a different coordinate system than my openGL?
For example, I have this texture drawn:
glBegin(GL_QUADS);
glTexCoord2f(0,1); glVertex3f(0,-200,0);
glTexCoord2f(1,1); glVertex3f(100,-200,0);
glTexCoord2f(1,0); glVertex3f(100,-250,0);
glTexCoord2f(0,0); glVertex3f(0,-250,0);
glEnd();
But when I’m trying to click on that texture w/ this function…
void mouse(int button, int state, int x, int y)
{
if (button==GLUT_LEFT && state==GLUT_DOWN)
{
if (x>0 && x<100 && y>-250 && y<-250)
{
cout << "inside
";
}
else
{
cout << "not inside
";
cout << "x: " << x << "
";
cout << "y: " << y << "
";
}
}
}
My output is saying “not inside” with x=223 & y=314.