#include <stdio.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
const GLint WIDTH = 800, HEIGHT = 600;
void error_callback(int error, const char* description) {
puts(description);
}
int main() {
glfwSetErrorCallback(error_callback);
if (!glfwInit()) {
printf("ERROR: GLFW failed to Initialize\n");
return 1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "Test Window", NULL, NULL);
if (!window) {
printf("ERROR: GLFW window creation falied!\n");
glfwTerminate();
return 1;
}
int bufferWidth, bufferHeigth;
glfwGetFramebufferSize(window, &bufferWidth, &bufferHeigth);
glfwMakeContextCurrent(window);
if (glewInit() != GLEW_OK) {
printf("ERROR: GLEW initialize falied!\n");
glfwDestroyWindow(window);
glfwTerminate();
return 1;
}
glViewport(0, 0, bufferWidth, bufferHeigth);
while (!glfwWindowShouldClose(window)) {
glfwPollEvents();
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
}
return 0;
/*
run:
*/
}