I'm a Java programmer, learning opengl in C for the first time. I wanna dissect this simple code that my instructor gave me without much explanation:
void renderScene (void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glFlush();
void init(); {
int submenu;
submenu = glutCreateMenu(menuApp);
glutAddMenuEntry("Option A",1);
glutAddMenuEntry("Option B",2);
glutAddMenuEntry("Option C",3);
glutCreateMenu(menuApp);
glutAddSubMenu("SubMenu",submenu);
glutAddMenuEntry("Salir",4);
glutAttachMenu(GLUT_RIGHT_BUTTON);
}
}
Questions:
a) What does void renderScene (void)
means? Why should this function take a void
paramether?
b) What the hell is void init(); {}
? Why both ; and {}? Why is it inside the renderScene
function?