src/gl.h: the OpenGL entry points the game calls, loaded through SDL (no libepoxy), as in smack-a-brother

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-19 21:45:50 -05:00
1 parent 2b108ca729
commit 08ca87dded
2 files changed
+92

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
#pragma once
#define GL_GLEXT_PROTOTYPES
#include <SDL3/SDL_opengl.h>
// The OpenGL entry points the game calls, loaded through SDL once a context exists.
#define GL_FUNCTIONS(X)\
X(ActiveTexture) \
X(AttachShader) \
X(BindFramebuffer) \
X(BindRenderbuffer) \
X(BindTexture) \
X(BlendEquation) \
X(BlendFuncSeparate) \
X(CheckFramebufferStatus) \
X(Clear) \
X(ClearColor) \
X(ClearDepth) \
X(CompileShader) \
X(CreateProgram) \
X(CreateShader) \
X(CullFace) \
X(DeleteFramebuffers) \
X(DeleteProgram) \
X(DeleteRenderbuffers) \
X(DeleteShader) \
X(DeleteTextures) \
X(DepthFunc) \
X(Disable) \
X(DisableVertexAttribArray) \
X(DrawElements) \
X(Enable) \
X(EnableVertexAttribArray) \
X(FramebufferRenderbuffer) \
X(FramebufferTexture2D) \
X(GenFramebuffers) \
X(GenRenderbuffers) \
X(GenTextures) \
X(GetAttribLocation) \
X(GetIntegerv) \
X(GetProgramInfoLog) \
X(GetProgramiv) \
X(GetRenderbufferParameteriv) \
X(GetShaderInfoLog) \
X(GetShaderiv) \
X(GetString) \
X(GetStringi) \
X(GetUniformLocation) \
X(LinkProgram) \
X(ReadPixels) \
X(RenderbufferStorage) \
X(ShaderSource) \
X(TexImage2D) \
X(TexParameteri) \
X(TexSubImage2D) \
X(Uniform1fv) \
X(Uniform1i) \
X(Uniform1iv) \
X(Uniform2fv) \
X(Uniform3fv) \
X(Uniform4fv) \
X(UniformMatrix4fv) \
X(UseProgram) \
X(VertexAttribPointer) \
X(Viewport)
struct Gl
{
#define GL_FUNCTION_DECLARE(name) decltype(&gl##name) name = nullptr;
GL_FUNCTIONS(GL_FUNCTION_DECLARE)
#undef GL_FUNCTION_DECLARE
bool isLoaded = false;
};
extern Gl gl;
void gl_load();