// To compile on Windows // Install GLFW 3.3.8 // https://www.glfw.org/download.html // Install GLEW 2.2.0 // https://github.com/nigels-com/glew/releases/tag/glew-2.2.0 // // extract the downloaded .zip files to "C:/libs"; this is currently expected // by our CMakeLists.txt. // Install CMake // https://cmake.org/download // Add to PATH for all users // from project root: // mkdir build // cd build // cmake .. // cmake --build . // The last step compiles the executable - this can also be done from Visual // Studio // To run in VS // Set startup project in Solution Explorer // Press F5 to run // To run in VSCode // https://code.visualstudio.com/docs/cpp/config-mingw // To compile on Arch Linux // // Install dependencies // sudo pacman -S glfw mesa glew // // Build // cmake .. // cmake --build . #include #include #include "gfx.hpp" #include "icosphere.hpp" #include "orbit.hpp" int main() { GLFWwindow* window = nullptr; if (initGraphics(&window, "Hello Astro") != 0) return -1; GLuint litProgram = compileShaderProgram("./frag_lit.glsl"); GLuint unlitProgram = compileShaderProgram("./frag_unlit.glsl"); Icosphere sphere(0.5, 2); Orbit orbit(100); // Main loop while (!glfwWindowShouldClose(window)) { glClearColor(0.2, 0.3, 0.3, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); float time = glfwGetTime(); // Render lit objects glUseProgram(litProgram); updateModelViewProjectionMatrix(litProgram, time); sphere.render(); // Render unlit objects glUseProgram(unlitProgram); updateModelViewProjectionMatrix(unlitProgram, time); orbit.render(); glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; }