Basic Window

This commit is contained in:
k 2024-12-06 12:46:38 -05:00
parent b045b1e2d3
commit 8d28b81b89

View File

@ -1,6 +1,40 @@
#include <glad/glad.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <cassert>
int main(void){
#define UNUSED(x) (void)(x)
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
int main(void) {
int tmp = 0;
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow *window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
assert(window != NULL && "Window Failed");
glfwMakeContextCurrent(window);
tmp = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
assert(tmp && "Failed to init glad");
glViewport(0, 0, 800, 600);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
while(!glfwWindowShouldClose(window))
{
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
UNUSED(window);
glViewport(0, 0, width, height);
}