People, i am really baffled. This simple teapot lools distorted and i can’t figure out why. And why is that wirecube not drawing? Can u please help me out?
Thanks.
#include <GL/glut.h>
#include <stdlib.h>
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(8.0, 3.0, 8.0, 8.0, 3.0, 0.0, 0.0, 1.0, 0.0);
glColor3f(0.8,0.2,0.1);
glutWireTeapot(2.0);
glTranslatef(5.0, 0.0, 0.0);
glutWireCube(1.0);
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
float aspect = (float)w/(float)h;
glClearColor(1.0,1.0,1.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(120.0,aspect,0.0,10.0);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (700, 450);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}