Esempio n. 1
0
int main(int argc, char *argv[])
{
    
    init();
    
    glfwInit();
    
    window = glfwCreateWindow(1024, 1024, "OpenGL", nullptr, nullptr); // Windowed
    glfwMakeContextCurrent(window);
    glfwSwapInterval(1);
	glClearColor(0.8f, 0.8f, 0.8f, 0.8f);
    while(!glfwWindowShouldClose(window)){
        
        float ratio;
        int width, height;
       
        glfwGetFramebufferSize(window, &width, &height);
        ratio = width / (float) height;
        
        glViewport(0, 0, width, height);
        glClear(GL_COLOR_BUFFER_BIT);
        
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();

        glOrtho(-50.0, 562.0, -50.0, 562.0, -1, 1);
        
        box.DrawBox(show_grid);
		drawText();
        calculateAcceleration();
        handleInputs();
        display();
        idle();
        
        //Swap front and back buffers
        glfwSetWindowSizeCallback(window, reshape_window);
        glfwSwapBuffers(window);
        
        //Poll for and process events
        glfwPollEvents();
        
    }
    
    
    glfwDestroyWindow(window);
    glfwTerminate();
    
    return EXIT_SUCCESS;
    
}