Initial commit - some engine bugs stopping compiling
This commit is contained in:
40
third-party/glad/test/c/run/gl/on-demand/001/test.c
vendored
Normal file
40
third-party/glad/test/c/run/gl/on-demand/001/test.c
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Core 3.3 profile using glfw to load on-demand
|
||||
*
|
||||
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --on-demand
|
||||
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
|
||||
* RUN: $tmp/test
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
|
||||
#define WIDTH 50
|
||||
#define HEIGHT 50
|
||||
|
||||
int main(void) {
|
||||
ASSERT(glfwInit(), "glfw init failed");
|
||||
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
|
||||
ASSERT(window != NULL, "glfw window creation failed");
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
gladSetGLOnDemandLoader(glfwGetProcAddress);
|
||||
|
||||
glViewport(0, 0, WIDTH, HEIGHT);
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
38
third-party/glad/test/c/run/gl/on-demand/002/test.c
vendored
Normal file
38
third-party/glad/test/c/run/gl/on-demand/002/test.c
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Core 3.3 profile builtin on-demand loader
|
||||
*
|
||||
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --on-demand --loader
|
||||
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
|
||||
* RUN: $tmp/test
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
|
||||
#define WIDTH 50
|
||||
#define HEIGHT 50
|
||||
|
||||
int main(void) {
|
||||
ASSERT(glfwInit(), "glfw init failed");
|
||||
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
|
||||
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
|
||||
ASSERT(window != NULL, "glfw window creation failed");
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
glViewport(0, 0, WIDTH, HEIGHT);
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user