Witam mam problem z tym oto kodem, bo powinien działać, ale mu się nie chce wyświetlić kulki, proszę o pomoc w rozwikłaniu mojego problemu.
#include <GL/glut.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
void specialKey(int key, int x, int y) {
switch(key) {
case GLUT_KEY_LEFT : // Rotate on x axis
break;
case GLUT_KEY_RIGHT : // Rotate on x axis (opposite)
break;
case GLUT_KEY_UP : // Rotate on y axis
break;
case GLUT_KEY_DOWN : // Rotate on y axis (opposite)
break;
case GLUT_KEY_PAGE_UP: // Rotate on z axis
break;
case GLUT_KEY_PAGE_DOWN:// Rotate on z axis (opposite)
break;
}
glutPostRedisplay(); // Redraw the scene
}
void procKey(unsigned char key, int x, int y) {
switch(key) {
case 27 :
case 'q':
exit(0);
break;
}
glutPostRedisplay(); // Redraw the scene
}
void Kulka() {
GLfloat x,y,kat;
const GLfloat GL_PI=3.1415f;
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0.0f, 0.0f, -6.0f); //srodek kola
for(kat = 0.0f; kat < (2.0f*GL_PI); kat += (GL_PI/32.0f)) {
x = 1.5f*sin(kat);
y = 1.5f*cos(kat);
glVertex3f(x, y, -6.0f);
}
glEnd();
// skierowanie poleceń do wykonania
glFlush ();
}
void Frame() {
// kolor tła - zawartość bufora koloru
glClearColor (1.0,1.0,1.0,1.0);
// czyszczenie bufora koloru
glClear (GL_COLOR_BUFFER_BIT);
// kolor kwadratu
glColor3f (1.0,0.0,0.0);
Kulka();
// zamiana buforów koloru
glutSwapBuffers();
}
int main(int argc, char** argv) {
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(1024, 768); /* X Y pixel screen window */
glutCreateWindow("Pan Kulka"); /* window title */
glutDisplayFunc(Frame); /* tell OpenGL main loop what */
glutSpecialFunc(specialKey);
glutKeyboardFunc(procKey);
glutMainLoop(); /* pass control to the main loop */
}