I am using glut.
when the program runs, and I drag the window to a new location, one of the objects moves position and also gets smaller. When I resize the window, it goes back to where it should be. Its not making sense to me.
#include <GLUT/glut.h>
#include <stdlib.h>
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glTranslatef(0, -3.0, -10);
glutSolidSphere(1.0, 10, 8); /* mid sphere */ //this is the one that changes
glLoadIdentity();
glTranslatef(-3, -3.0, -10);
glutWireSphere(1.0, 10, 8); /* left sphere */
glLoadIdentity();
glTranslatef(3, -3.0, -10);
glutWireSphere(1.0, 10, 8); /* right sphere */
glutSwapBuffers();
}
void reshape(int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (1024, 768);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
// glutMouseFunc(mouse);
// glutKeyboardFunc(keyb);
glutMainLoop();
return 0;
}
anyone know why this is happening?
btw im using:
GLUT
mac os x 10.4 ppc
xcode