#define GLAD_GL_IMPLEMENTATION #include "glad/gl.h" #define GLFW_INCLUDE_NONE #include "GLFW/glfw3.h" static void key_callback(GLFWwindow *w, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) { glfwSetWindowShouldClose(w, GL_TRUE); } } int main() { // Initialise GLFW if (!glfwInit()) { exit(EXIT_FAILURE); } glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); // Create our context GLFWwindow *w = glfwCreateWindow(640, 480, "Test", NULL, NULL); if (!w) { glfwTerminate(); exit(EXIT_FAILURE); } glfwMakeContextCurrent(w); glfwSwapInterval(1); // Essentially vsync gladLoadGL(glfwGetProcAddress); // Load openGL using glfw // Set up the key handler glfwSetKeyCallback(w, key_callback); // Configure the context's capabilities glClearColor(1.0, 0.0, 0.0, 1.0); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); // Maybe this allows transparency? glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // TODO: Actually make some opengl shit happen // Main Loop while(!glfwWindowShouldClose(w)) { /* int width, height; glfwGetFramebufferSize(w, &width, &height); glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT); */ // TODO Draw primitives glfwSwapBuffers(w); glfwPollEvents(); } glfwDestroyWindow(w); glfwTerminate(); exit(EXIT_SUCCESS); }