int main(void){ int running = GL_TRUE; char currentKey = 'A'; SphereRotate sphereA; coneRotate coneB; SphereNormals normalsC; Paths pathsE; SphereShaded shadedD; //initialise GLFW if(!glfwInit()) { exit(EXIT_FAILURE); } //open window if(!glfwOpenWindow(600, 600, 0, 0, 0, 0, 0, 0, GLFW_WINDOW)){ glfwTerminate(); exit(EXIT_FAILURE); } glewInit(); if(!(sphereA.init() && coneB.init() && normalsC.init() && pathsE.init() && shadedD.init())) exit(EXIT_FAILURE); while( running ) { //render here glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0, 0, 0, 1); if(currentKey == 'A'){ sphereA.render(); } else if(currentKey =='B'){ coneB.render(); } else if(currentKey == 'C'){ normalsC.render(); } else if(currentKey == 'D'){ shadedD.render(); } else if(currentKey == 'E'){ pathsE.render(); } //check("draw"); glfwSwapBuffers(); //check("swap buffers"); //check esc key running= !(glfwGetKey(GLFW_KEY_ESC) || glfwGetKey('Q')) && glfwGetWindowParam(GLFW_OPENED); if(glfwGetKey('A')) currentKey = 'A'; else if(glfwGetKey('B')) currentKey='B'; else if(glfwGetKey('C')) currentKey='C'; else if(glfwGetKey('D')) currentKey='D'; else if(glfwGetKey('E')) currentKey = 'E'; glFlush(); } //end app glfwTerminate(); exit(EXIT_SUCCESS); }