mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-05 19:08:13 +00:00
Merge pull request #5062 from danilwhale/feat/get-proc-address
[rlgl] Add rlGetProcAddress
This commit is contained in:
15
src/rlgl.h
15
src/rlgl.h
@@ -710,6 +710,7 @@ RLAPI void rlSetBlendFactorsSeparate(int glSrcRGB, int glDstRGB, int glSrcAlpha,
|
||||
RLAPI void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states)
|
||||
RLAPI void rlglClose(void); // De-initialize rlgl (buffers, shaders, textures)
|
||||
RLAPI void rlLoadExtensions(void *loader); // Load OpenGL extensions (loader function required)
|
||||
RLAPI void *rlGetProcAddress(const char *procName); // Get OpenGL procedure address
|
||||
RLAPI int rlGetVersion(void); // Get current OpenGL version
|
||||
RLAPI void rlSetFramebufferWidth(int width); // Set current framebuffer width
|
||||
RLAPI int rlGetFramebufferWidth(void); // Get default framebuffer width
|
||||
@@ -1041,10 +1042,15 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad
|
||||
// Types and Structures Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
|
||||
typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions loader signature (same as GLADloadproc)
|
||||
|
||||
typedef struct rlglData {
|
||||
rlRenderBatch *currentBatch; // Current render batch
|
||||
rlRenderBatch defaultBatch; // Default internal render batch
|
||||
|
||||
rlglLoadProc loader; // OpenGL function loader
|
||||
|
||||
struct {
|
||||
int vertexCounter; // Current active render batch vertex counter (generic, used for all batches)
|
||||
float texcoordx, texcoordy; // Current active texture coordinate (added on glVertex*())
|
||||
@@ -1114,8 +1120,6 @@ typedef struct rlglData {
|
||||
} ExtSupported; // Extensions supported flags
|
||||
} rlglData;
|
||||
|
||||
typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions loader signature (same as GLADloadproc)
|
||||
|
||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -2567,6 +2571,8 @@ void rlLoadExtensions(void *loader)
|
||||
TRACELOG(RL_LOG_INFO, " > Version: %s", glGetString(GL_VERSION));
|
||||
TRACELOG(RL_LOG_INFO, " > GLSL: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
|
||||
RLGL.loader = (rlglLoadProc)loader;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// NOTE: Anisotropy levels capability is an extension
|
||||
#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
||||
@@ -2625,6 +2631,11 @@ void rlLoadExtensions(void *loader)
|
||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
||||
}
|
||||
|
||||
// Get OpenGL procedure address
|
||||
void *rlGetProcAddress(const char *procName) {
|
||||
return RLGL.loader(procName);
|
||||
}
|
||||
|
||||
// Get current OpenGL version
|
||||
int rlGetVersion(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user