From 99f6707e2c80be2ac4c169fd6986ff2fd8d181a7 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 16 Oct 2021 23:49:31 +0200 Subject: [PATCH] Support OpenGL 4.3 - Support Compute Shaders by rlgl API - Support SSBO by rlgl API --- src/rcore.c | 7 +++++++ src/rlgl.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/rcore.c b/src/rcore.c index 1e4047c7c..44388c397 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -3758,6 +3758,13 @@ static bool InitGraphicsDevice(int width, int height) #endif //glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE); // Request OpenGL DEBUG context } + else if (rlGetVersion() == OPENGL_43) + { + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); // Choose OpenGL major version (just hint) + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); // Choose OpenGL minor version (just hint) + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_FALSE); + } else if (rlGetVersion() == OPENGL_ES_20) // Request OpenGL ES 2.0 context { glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); diff --git a/src/rlgl.h b/src/rlgl.h index 32659c7e5..adf5ccf95 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -280,6 +280,7 @@ typedef enum { OPENGL_11 = 1, OPENGL_21, OPENGL_33, + OPENGL_43, OPENGL_ES_20 } rlGlVersion; @@ -732,6 +733,7 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #define GLAD_REALLOC RL_REALLOC #define GLAD_FREE RL_FREE + #define GLAD_IMPLEMENTATION #include "external/glad.h" // GLAD extensions loading library, includes OpenGL headers #endif #endif @@ -2125,6 +2127,9 @@ int rlGetVersion(void) #elif defined(GRAPHICS_API_OPENGL_33) glVersion = OPENGL_33; #endif +#if defined(GRAPHICS_API_OPENGL_43) + glVersion = OPENGL_43; +#endif #if defined(GRAPHICS_API_OPENGL_ES2) glVersion = OPENGL_ES_20; #endif