Initial commit - some engine bugs stopping compiling
This commit is contained in:
44
third-party/glad/example/c/gl_glfw.c
vendored
Normal file
44
third-party/glad/example/c/gl_glfw.c
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define GLAD_GL_IMPLEMENTATION // Necessary for headeronly version.
|
||||
#include <glad/gl.h>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
|
||||
const GLuint WIDTH = 800, HEIGHT = 600;
|
||||
|
||||
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode) {
|
||||
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, GL_TRUE);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
glfwInit();
|
||||
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "[glad] GL with GLFW", NULL, NULL);
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
int version = gladLoadGL(glfwGetProcAddress);
|
||||
printf("GL %d.%d\n", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
|
||||
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
glfwPollEvents();
|
||||
|
||||
glClearColor(0.7f, 0.9f, 0.1f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user