Dobrý den,
Postupoval jsem podle vašeho tutoriálu na OGL, zde je ten kód:
#include <gl/glut.h>
void onResize(int w, int h) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, w, h);
gluPerspective(45,(double)w/(double)h,1,100);
glMatrixMode(GL_MODELVIEW);
}
void init() {
glEnable(GL_DEPTH_TEST);
glClearColor(1.0,1.0,1.0,1.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
}
void onDisplay(void){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
glTranslatef(0.0, 0.0, -2.0);
glRotatef(20,1.0,1.0,1.0);
glBegin(GL_QUADS);
glNormal3f(0.0,0.0,1.0); //normála mí?í sm?rem k nám po ose z
glVertex3f(-0.1,0.1,0.0);
glVertex3f(0.1,0.1,0.0);
glVertex3f(0.1,-0.1,0.0);
glVertex3f(-0.1,-0.1,0.0);
glEnd();
glutSwapBuffers();
}
int main (int argc, char **argv) {
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowSize(640,480);
glutInitWindowPosition(10,10);
glutCreateWindow("okno");
glutDisplayFunc(init);
glutIdleFunc(onDisplay);
glutReshapeFunc(onResize);
glutMainLoop();
return 0;
}