KerelOlivier
2 years ago
2 changed files with 53 additions and 1 deletions
@ -1,6 +1,48 @@ |
|||||||
#include <iostream> |
#include <iostream> |
||||||
|
|
||||||
|
#include <glad/glad.h> |
||||||
|
#include <GLFW/glfw3.h> |
||||||
|
|
||||||
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height); |
||||||
|
|
||||||
int main() { |
int main() { |
||||||
std::cout << "Hello, World!" << std::endl; |
std::cout << "Hello, World!" << std::endl; |
||||||
|
|
||||||
|
glfwInit(); |
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); |
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); |
||||||
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); |
||||||
|
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); |
||||||
|
|
||||||
|
GLFWwindow* window = glfwCreateWindow(800, 600, "Voronoi", NULL, NULL); |
||||||
|
if (window == NULL) { |
||||||
|
std::cout << "Failed to create GLFW window" << std::endl; |
||||||
|
glfwTerminate(); |
||||||
|
return -1; |
||||||
|
} |
||||||
|
glfwMakeContextCurrent(window); |
||||||
|
|
||||||
|
if(gladLoadGLLoader((GLADloadproc)glfwGetProcAddress) == 0) { |
||||||
|
std::cout << "Failed to initialize GLAD" << std::endl; |
||||||
|
return -1; |
||||||
|
} |
||||||
|
|
||||||
|
glViewport(0, 0, 800, 600); |
||||||
|
|
||||||
|
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); |
||||||
|
|
||||||
|
while(!glfwWindowShouldClose(window)) { |
||||||
|
glfwPollEvents(); |
||||||
|
glClearColor(0.2f, 0.3f, 0.3f, 1.0f); |
||||||
|
glClear(GL_COLOR_BUFFER_BIT); |
||||||
|
|
||||||
|
glfwSwapBuffers(window); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
return 0; |
return 0; |
||||||
} |
} |
||||||
|
|
||||||
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height) { |
||||||
|
glViewport(0, 0, width, height); |
||||||
|
} |
||||||
|
Loading…
Reference in new issue