GLAD liberay

This commit is contained in:
2020-06-20 19:15:43 +02:00
parent bf9b798c28
commit 5365d44f9c
6 changed files with 3590 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <GL/glew.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include "main.h"
@ -24,8 +24,26 @@ int main() {
return -1;
}
glfwMakeContextCurrent(window);
glewExperimental = true;
if(!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
printf("Failed to initialize GLAD\n");
return -1;
}
glViewport(0, 0, 1920, 1080);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
while(!glfwWindowShouldClose(window)) {
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
void glfwError(int id, const char* description) {
printf("Glfw Error: %s\n", description);
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
glViewport(0, 0, width, height);
}

View File

@ -1,4 +1,7 @@
#ifndef main_h
#define main_h
#include <glad/glad.h>
#include <GLFW/glfw3.h>
void glfwError(int id, const char* description);
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
#endif