From 8a66bc43e4db8288e4a78e30346d93f55cfbdb49 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Tue, 30 Jul 2024 23:37:34 +0300 Subject: [PATCH] bypass of near/far planes for 2d case, hints for perspective correction, flat shading for 2d --- src/main.c | 4 + src/rendering.c | 13 +++ third-party/glad/include/glad/glad.h | 166 ++------------------------- third-party/glad/src/glad.c | 94 +-------------- 4 files changed, 31 insertions(+), 246 deletions(-) diff --git a/src/main.c b/src/main.c index d5be625..b822438 100644 --- a/src/main.c +++ b/src/main.c @@ -234,6 +234,10 @@ static bool initialize(void) { log_info("OpenGL context: %s\n", glGetString(GL_VERSION)); + glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST); + glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST); + glHint(GL_FOG_HINT, GL_FASTEST); + /* might need this to have multiple windows */ ctx.window_id = SDL_GetWindowID(ctx.window); diff --git a/src/rendering.c b/src/rendering.c index ec2fa6b..ef1d96e 100644 --- a/src/rendering.c +++ b/src/rendering.c @@ -164,6 +164,12 @@ void render(void) { GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + glShadeModel(GL_SMOOTH); + + if (GLAD_GL_ARB_depth_clamp) + glDisable(GL_DEPTH_CLAMP); + { glMatrixMode(GL_PROJECTION); glLoadMatrixf(&camera_projection_matrix.row[0].x); @@ -178,6 +184,13 @@ void render(void) { glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glFlush(); + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + glShadeModel(GL_FLAT); + + /* removes near/far plane comparison and discard */ + if (GLAD_GL_ARB_depth_clamp) + glDisable(GL_DEPTH_CLAMP); + { glMatrixMode(GL_PROJECTION); glLoadIdentity(); diff --git a/third-party/glad/include/glad/glad.h b/third-party/glad/include/glad/glad.h index d040d4e..babfb65 100644 --- a/third-party/glad/include/glad/glad.h +++ b/third-party/glad/include/glad/glad.h @@ -1,13 +1,13 @@ /* - OpenGL loader generated by glad 0.1.36 on Wed Jul 10 12:56:38 2024. + OpenGL loader generated by glad 0.1.36 on Tue Jul 30 20:14:16 2024. Language/Generator: C/C++ Specification: gl APIs: gl=1.5 Profile: compatibility Extensions: - GL_ARB_shader_objects, + GL_ARB_depth_clamp, GL_KHR_debug Loader: True Local files: False @@ -15,9 +15,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_shader_objects,GL_KHR_debug" + --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_depth_clamp,GL_KHR_debug" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_shader_objects&extensions=GL_KHR_debug + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_depth_clamp&extensions=GL_KHR_debug */ @@ -2279,40 +2279,7 @@ typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; #define glGetBufferPointerv glad_glGetBufferPointerv #endif -#define GL_PROGRAM_OBJECT_ARB 0x8B40 -#define GL_SHADER_OBJECT_ARB 0x8B48 -#define GL_OBJECT_TYPE_ARB 0x8B4E -#define GL_OBJECT_SUBTYPE_ARB 0x8B4F -#define GL_FLOAT_VEC2_ARB 0x8B50 -#define GL_FLOAT_VEC3_ARB 0x8B51 -#define GL_FLOAT_VEC4_ARB 0x8B52 -#define GL_INT_VEC2_ARB 0x8B53 -#define GL_INT_VEC3_ARB 0x8B54 -#define GL_INT_VEC4_ARB 0x8B55 -#define GL_BOOL_ARB 0x8B56 -#define GL_BOOL_VEC2_ARB 0x8B57 -#define GL_BOOL_VEC3_ARB 0x8B58 -#define GL_BOOL_VEC4_ARB 0x8B59 -#define GL_FLOAT_MAT2_ARB 0x8B5A -#define GL_FLOAT_MAT3_ARB 0x8B5B -#define GL_FLOAT_MAT4_ARB 0x8B5C -#define GL_SAMPLER_1D_ARB 0x8B5D -#define GL_SAMPLER_2D_ARB 0x8B5E -#define GL_SAMPLER_3D_ARB 0x8B5F -#define GL_SAMPLER_CUBE_ARB 0x8B60 -#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 -#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 -#define GL_SAMPLER_2D_RECT_ARB 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 -#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 -#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 -#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 -#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 -#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 -#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 -#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 -#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 -#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#define GL_DEPTH_CLAMP 0x864F #define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243 #define GL_DEBUG_CALLBACK_FUNCTION 0x8244 @@ -2391,126 +2358,9 @@ GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; #define GL_STACK_OVERFLOW_KHR 0x0503 #define GL_STACK_UNDERFLOW_KHR 0x0504 #define GL_DISPLAY_LIST 0x82E7 -#ifndef GL_ARB_shader_objects -#define GL_ARB_shader_objects 1 -GLAPI int GLAD_GL_ARB_shader_objects; -typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC)(GLhandleARB obj); -GLAPI PFNGLDELETEOBJECTARBPROC glad_glDeleteObjectARB; -#define glDeleteObjectARB glad_glDeleteObjectARB -typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC)(GLenum pname); -GLAPI PFNGLGETHANDLEARBPROC glad_glGetHandleARB; -#define glGetHandleARB glad_glGetHandleARB -typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC)(GLhandleARB containerObj, GLhandleARB attachedObj); -GLAPI PFNGLDETACHOBJECTARBPROC glad_glDetachObjectARB; -#define glDetachObjectARB glad_glDetachObjectARB -typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC)(GLenum shaderType); -GLAPI PFNGLCREATESHADEROBJECTARBPROC glad_glCreateShaderObjectARB; -#define glCreateShaderObjectARB glad_glCreateShaderObjectARB -typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC)(GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); -GLAPI PFNGLSHADERSOURCEARBPROC glad_glShaderSourceARB; -#define glShaderSourceARB glad_glShaderSourceARB -typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC)(GLhandleARB shaderObj); -GLAPI PFNGLCOMPILESHADERARBPROC glad_glCompileShaderARB; -#define glCompileShaderARB glad_glCompileShaderARB -typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC)(void); -GLAPI PFNGLCREATEPROGRAMOBJECTARBPROC glad_glCreateProgramObjectARB; -#define glCreateProgramObjectARB glad_glCreateProgramObjectARB -typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC)(GLhandleARB containerObj, GLhandleARB obj); -GLAPI PFNGLATTACHOBJECTARBPROC glad_glAttachObjectARB; -#define glAttachObjectARB glad_glAttachObjectARB -typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC)(GLhandleARB programObj); -GLAPI PFNGLLINKPROGRAMARBPROC glad_glLinkProgramARB; -#define glLinkProgramARB glad_glLinkProgramARB -typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC)(GLhandleARB programObj); -GLAPI PFNGLUSEPROGRAMOBJECTARBPROC glad_glUseProgramObjectARB; -#define glUseProgramObjectARB glad_glUseProgramObjectARB -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC)(GLhandleARB programObj); -GLAPI PFNGLVALIDATEPROGRAMARBPROC glad_glValidateProgramARB; -#define glValidateProgramARB glad_glValidateProgramARB -typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC)(GLint location, GLfloat v0); -GLAPI PFNGLUNIFORM1FARBPROC glad_glUniform1fARB; -#define glUniform1fARB glad_glUniform1fARB -typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC)(GLint location, GLfloat v0, GLfloat v1); -GLAPI PFNGLUNIFORM2FARBPROC glad_glUniform2fARB; -#define glUniform2fARB glad_glUniform2fARB -typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI PFNGLUNIFORM3FARBPROC glad_glUniform3fARB; -#define glUniform3fARB glad_glUniform3fARB -typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI PFNGLUNIFORM4FARBPROC glad_glUniform4fARB; -#define glUniform4fARB glad_glUniform4fARB -typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC)(GLint location, GLint v0); -GLAPI PFNGLUNIFORM1IARBPROC glad_glUniform1iARB; -#define glUniform1iARB glad_glUniform1iARB -typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC)(GLint location, GLint v0, GLint v1); -GLAPI PFNGLUNIFORM2IARBPROC glad_glUniform2iARB; -#define glUniform2iARB glad_glUniform2iARB -typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC)(GLint location, GLint v0, GLint v1, GLint v2); -GLAPI PFNGLUNIFORM3IARBPROC glad_glUniform3iARB; -#define glUniform3iARB glad_glUniform3iARB -typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI PFNGLUNIFORM4IARBPROC glad_glUniform4iARB; -#define glUniform4iARB glad_glUniform4iARB -typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM1FVARBPROC glad_glUniform1fvARB; -#define glUniform1fvARB glad_glUniform1fvARB -typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM2FVARBPROC glad_glUniform2fvARB; -#define glUniform2fvARB glad_glUniform2fvARB -typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM3FVARBPROC glad_glUniform3fvARB; -#define glUniform3fvARB glad_glUniform3fvARB -typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM4FVARBPROC glad_glUniform4fvARB; -#define glUniform4fvARB glad_glUniform4fvARB -typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM1IVARBPROC glad_glUniform1ivARB; -#define glUniform1ivARB glad_glUniform1ivARB -typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM2IVARBPROC glad_glUniform2ivARB; -#define glUniform2ivARB glad_glUniform2ivARB -typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM3IVARBPROC glad_glUniform3ivARB; -#define glUniform3ivARB glad_glUniform3ivARB -typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM4IVARBPROC glad_glUniform4ivARB; -#define glUniform4ivARB glad_glUniform4ivARB -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX2FVARBPROC glad_glUniformMatrix2fvARB; -#define glUniformMatrix2fvARB glad_glUniformMatrix2fvARB -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX3FVARBPROC glad_glUniformMatrix3fvARB; -#define glUniformMatrix3fvARB glad_glUniformMatrix3fvARB -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX4FVARBPROC glad_glUniformMatrix4fvARB; -#define glUniformMatrix4fvARB glad_glUniformMatrix4fvARB -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC)(GLhandleARB obj, GLenum pname, GLfloat *params); -GLAPI PFNGLGETOBJECTPARAMETERFVARBPROC glad_glGetObjectParameterfvARB; -#define glGetObjectParameterfvARB glad_glGetObjectParameterfvARB -typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC)(GLhandleARB obj, GLenum pname, GLint *params); -GLAPI PFNGLGETOBJECTPARAMETERIVARBPROC glad_glGetObjectParameterivARB; -#define glGetObjectParameterivARB glad_glGetObjectParameterivARB -typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); -GLAPI PFNGLGETINFOLOGARBPROC glad_glGetInfoLogARB; -#define glGetInfoLogARB glad_glGetInfoLogARB -typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC)(GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); -GLAPI PFNGLGETATTACHEDOBJECTSARBPROC glad_glGetAttachedObjectsARB; -#define glGetAttachedObjectsARB glad_glGetAttachedObjectsARB -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC)(GLhandleARB programObj, const GLcharARB *name); -GLAPI PFNGLGETUNIFORMLOCATIONARBPROC glad_glGetUniformLocationARB; -#define glGetUniformLocationARB glad_glGetUniformLocationARB -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC)(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); -GLAPI PFNGLGETACTIVEUNIFORMARBPROC glad_glGetActiveUniformARB; -#define glGetActiveUniformARB glad_glGetActiveUniformARB -typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC)(GLhandleARB programObj, GLint location, GLfloat *params); -GLAPI PFNGLGETUNIFORMFVARBPROC glad_glGetUniformfvARB; -#define glGetUniformfvARB glad_glGetUniformfvARB -typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC)(GLhandleARB programObj, GLint location, GLint *params); -GLAPI PFNGLGETUNIFORMIVARBPROC glad_glGetUniformivARB; -#define glGetUniformivARB glad_glGetUniformivARB -typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC)(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); -GLAPI PFNGLGETSHADERSOURCEARBPROC glad_glGetShaderSourceARB; -#define glGetShaderSourceARB glad_glGetShaderSourceARB +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +GLAPI int GLAD_GL_ARB_depth_clamp; #endif #ifndef GL_KHR_debug #define GL_KHR_debug 1 diff --git a/third-party/glad/src/glad.c b/third-party/glad/src/glad.c index 0a07c64..eebaee0 100644 --- a/third-party/glad/src/glad.c +++ b/third-party/glad/src/glad.c @@ -1,13 +1,13 @@ /* - OpenGL loader generated by glad 0.1.36 on Wed Jul 10 12:56:38 2024. + OpenGL loader generated by glad 0.1.36 on Tue Jul 30 20:14:16 2024. Language/Generator: C/C++ Specification: gl APIs: gl=1.5 Profile: compatibility Extensions: - GL_ARB_shader_objects, + GL_ARB_depth_clamp, GL_KHR_debug Loader: True Local files: False @@ -15,9 +15,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_shader_objects,GL_KHR_debug" + --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="GL_ARB_depth_clamp,GL_KHR_debug" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_shader_objects&extensions=GL_KHR_debug + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5&extensions=GL_ARB_depth_clamp&extensions=GL_KHR_debug */ #include @@ -714,47 +714,8 @@ PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL; PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL; PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL; PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL; -int GLAD_GL_ARB_shader_objects = 0; +int GLAD_GL_ARB_depth_clamp = 0; int GLAD_GL_KHR_debug = 0; -PFNGLDELETEOBJECTARBPROC glad_glDeleteObjectARB = NULL; -PFNGLGETHANDLEARBPROC glad_glGetHandleARB = NULL; -PFNGLDETACHOBJECTARBPROC glad_glDetachObjectARB = NULL; -PFNGLCREATESHADEROBJECTARBPROC glad_glCreateShaderObjectARB = NULL; -PFNGLSHADERSOURCEARBPROC glad_glShaderSourceARB = NULL; -PFNGLCOMPILESHADERARBPROC glad_glCompileShaderARB = NULL; -PFNGLCREATEPROGRAMOBJECTARBPROC glad_glCreateProgramObjectARB = NULL; -PFNGLATTACHOBJECTARBPROC glad_glAttachObjectARB = NULL; -PFNGLLINKPROGRAMARBPROC glad_glLinkProgramARB = NULL; -PFNGLUSEPROGRAMOBJECTARBPROC glad_glUseProgramObjectARB = NULL; -PFNGLVALIDATEPROGRAMARBPROC glad_glValidateProgramARB = NULL; -PFNGLUNIFORM1FARBPROC glad_glUniform1fARB = NULL; -PFNGLUNIFORM2FARBPROC glad_glUniform2fARB = NULL; -PFNGLUNIFORM3FARBPROC glad_glUniform3fARB = NULL; -PFNGLUNIFORM4FARBPROC glad_glUniform4fARB = NULL; -PFNGLUNIFORM1IARBPROC glad_glUniform1iARB = NULL; -PFNGLUNIFORM2IARBPROC glad_glUniform2iARB = NULL; -PFNGLUNIFORM3IARBPROC glad_glUniform3iARB = NULL; -PFNGLUNIFORM4IARBPROC glad_glUniform4iARB = NULL; -PFNGLUNIFORM1FVARBPROC glad_glUniform1fvARB = NULL; -PFNGLUNIFORM2FVARBPROC glad_glUniform2fvARB = NULL; -PFNGLUNIFORM3FVARBPROC glad_glUniform3fvARB = NULL; -PFNGLUNIFORM4FVARBPROC glad_glUniform4fvARB = NULL; -PFNGLUNIFORM1IVARBPROC glad_glUniform1ivARB = NULL; -PFNGLUNIFORM2IVARBPROC glad_glUniform2ivARB = NULL; -PFNGLUNIFORM3IVARBPROC glad_glUniform3ivARB = NULL; -PFNGLUNIFORM4IVARBPROC glad_glUniform4ivARB = NULL; -PFNGLUNIFORMMATRIX2FVARBPROC glad_glUniformMatrix2fvARB = NULL; -PFNGLUNIFORMMATRIX3FVARBPROC glad_glUniformMatrix3fvARB = NULL; -PFNGLUNIFORMMATRIX4FVARBPROC glad_glUniformMatrix4fvARB = NULL; -PFNGLGETOBJECTPARAMETERFVARBPROC glad_glGetObjectParameterfvARB = NULL; -PFNGLGETOBJECTPARAMETERIVARBPROC glad_glGetObjectParameterivARB = NULL; -PFNGLGETINFOLOGARBPROC glad_glGetInfoLogARB = NULL; -PFNGLGETATTACHEDOBJECTSARBPROC glad_glGetAttachedObjectsARB = NULL; -PFNGLGETUNIFORMLOCATIONARBPROC glad_glGetUniformLocationARB = NULL; -PFNGLGETACTIVEUNIFORMARBPROC glad_glGetActiveUniformARB = NULL; -PFNGLGETUNIFORMFVARBPROC glad_glGetUniformfvARB = NULL; -PFNGLGETUNIFORMIVARBPROC glad_glGetUniformivARB = NULL; -PFNGLGETSHADERSOURCEARBPROC glad_glGetShaderSourceARB = NULL; PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl = NULL; PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert = NULL; PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback = NULL; @@ -1246,48 +1207,6 @@ static void load_GL_VERSION_1_5(GLADloadproc load) { glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); } -static void load_GL_ARB_shader_objects(GLADloadproc load) { - if(!GLAD_GL_ARB_shader_objects) return; - glad_glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)load("glDeleteObjectARB"); - glad_glGetHandleARB = (PFNGLGETHANDLEARBPROC)load("glGetHandleARB"); - glad_glDetachObjectARB = (PFNGLDETACHOBJECTARBPROC)load("glDetachObjectARB"); - glad_glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)load("glCreateShaderObjectARB"); - glad_glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)load("glShaderSourceARB"); - glad_glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)load("glCompileShaderARB"); - glad_glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)load("glCreateProgramObjectARB"); - glad_glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)load("glAttachObjectARB"); - glad_glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)load("glLinkProgramARB"); - glad_glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)load("glUseProgramObjectARB"); - glad_glValidateProgramARB = (PFNGLVALIDATEPROGRAMARBPROC)load("glValidateProgramARB"); - glad_glUniform1fARB = (PFNGLUNIFORM1FARBPROC)load("glUniform1fARB"); - glad_glUniform2fARB = (PFNGLUNIFORM2FARBPROC)load("glUniform2fARB"); - glad_glUniform3fARB = (PFNGLUNIFORM3FARBPROC)load("glUniform3fARB"); - glad_glUniform4fARB = (PFNGLUNIFORM4FARBPROC)load("glUniform4fARB"); - glad_glUniform1iARB = (PFNGLUNIFORM1IARBPROC)load("glUniform1iARB"); - glad_glUniform2iARB = (PFNGLUNIFORM2IARBPROC)load("glUniform2iARB"); - glad_glUniform3iARB = (PFNGLUNIFORM3IARBPROC)load("glUniform3iARB"); - glad_glUniform4iARB = (PFNGLUNIFORM4IARBPROC)load("glUniform4iARB"); - glad_glUniform1fvARB = (PFNGLUNIFORM1FVARBPROC)load("glUniform1fvARB"); - glad_glUniform2fvARB = (PFNGLUNIFORM2FVARBPROC)load("glUniform2fvARB"); - glad_glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC)load("glUniform3fvARB"); - glad_glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC)load("glUniform4fvARB"); - glad_glUniform1ivARB = (PFNGLUNIFORM1IVARBPROC)load("glUniform1ivARB"); - glad_glUniform2ivARB = (PFNGLUNIFORM2IVARBPROC)load("glUniform2ivARB"); - glad_glUniform3ivARB = (PFNGLUNIFORM3IVARBPROC)load("glUniform3ivARB"); - glad_glUniform4ivARB = (PFNGLUNIFORM4IVARBPROC)load("glUniform4ivARB"); - glad_glUniformMatrix2fvARB = (PFNGLUNIFORMMATRIX2FVARBPROC)load("glUniformMatrix2fvARB"); - glad_glUniformMatrix3fvARB = (PFNGLUNIFORMMATRIX3FVARBPROC)load("glUniformMatrix3fvARB"); - glad_glUniformMatrix4fvARB = (PFNGLUNIFORMMATRIX4FVARBPROC)load("glUniformMatrix4fvARB"); - glad_glGetObjectParameterfvARB = (PFNGLGETOBJECTPARAMETERFVARBPROC)load("glGetObjectParameterfvARB"); - glad_glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)load("glGetObjectParameterivARB"); - glad_glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)load("glGetInfoLogARB"); - glad_glGetAttachedObjectsARB = (PFNGLGETATTACHEDOBJECTSARBPROC)load("glGetAttachedObjectsARB"); - glad_glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)load("glGetUniformLocationARB"); - glad_glGetActiveUniformARB = (PFNGLGETACTIVEUNIFORMARBPROC)load("glGetActiveUniformARB"); - glad_glGetUniformfvARB = (PFNGLGETUNIFORMFVARBPROC)load("glGetUniformfvARB"); - glad_glGetUniformivARB = (PFNGLGETUNIFORMIVARBPROC)load("glGetUniformivARB"); - glad_glGetShaderSourceARB = (PFNGLGETSHADERSOURCEARBPROC)load("glGetShaderSourceARB"); -} static void load_GL_KHR_debug(GLADloadproc load) { if(!GLAD_GL_KHR_debug) return; glad_glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)load("glDebugMessageControl"); @@ -1315,7 +1234,7 @@ static void load_GL_KHR_debug(GLADloadproc load) { } static int find_extensionsGL(void) { if (!get_exts()) return 0; - GLAD_GL_ARB_shader_objects = has_ext("GL_ARB_shader_objects"); + GLAD_GL_ARB_depth_clamp = has_ext("GL_ARB_depth_clamp"); GLAD_GL_KHR_debug = has_ext("GL_KHR_debug"); free_exts(); return 1; @@ -1383,7 +1302,6 @@ int gladLoadGLLoader(GLADloadproc load) { load_GL_VERSION_1_5(load); if (!find_extensionsGL()) return 0; - load_GL_ARB_shader_objects(load); load_GL_KHR_debug(load); return GLVersion.major != 0 || GLVersion.minor != 0; }