28 lines
904 B
C
28 lines
904 B
C
// gl_utils.h
|
|
#ifndef GL_UTILS_H
|
|
#define GL_UTILS_H
|
|
|
|
|
|
#include "glad/glad.h"
|
|
#define GLFW_INCLUDE_NONE
|
|
#include <GLFW/glfw3.h>
|
|
// Error callback for GLFW
|
|
void glfw_error_callback(int error, const char* description);
|
|
|
|
// Read an entire text file into a null-terminated buffer.
|
|
// Caller must free() the returned pointer.
|
|
char* load_text_file(const char* path);
|
|
|
|
// Compile a single shader from source.
|
|
GLuint compile_shader(GLenum type, const char* source, const char* debugName);
|
|
|
|
// Compile & link a vertex+fragment program from files.
|
|
GLuint create_program_from_files(const char* vsPath, const char* fsPath);
|
|
|
|
// Minimal GLFW+GLAD init: sets error callback, (optionally) hints Wayland,
|
|
// calls glfwInit, creates window, makes context current, loads GLAD.
|
|
// Returns the created window or NULL on fatal error.
|
|
GLFWwindow* init_glfw_glad(const char* title, int width, int height);
|
|
|
|
#endif // GL_UTILS_H
|