I want to plot a rectangle by mouse click in opengl. But I failed to do it, it's very comfued, by the way, the rectangle just exists in a flash, then disappear.
void OnMouse(int button, int state, int x, int y)
{
glRectf(a,b,0,-10);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
......................
glutMouseFunc(OnMouse);
glutMainLoop();
return 0;
}
How can I solve it?