mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-07 18:36:27 +00:00
[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 rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states)
|
||||||
RLAPI void rlglClose(void); // De-initialize rlgl (buffers, shaders, textures)
|
RLAPI void rlglClose(void); // De-initialize rlgl (buffers, shaders, textures)
|
||||||
RLAPI void rlLoadExtensions(void *loader); // Load OpenGL extensions (loader function required)
|
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 int rlGetVersion(void); // Get current OpenGL version
|
||||||
RLAPI void rlSetFramebufferWidth(int width); // Set current framebuffer width
|
RLAPI void rlSetFramebufferWidth(int width); // Set current framebuffer width
|
||||||
RLAPI int rlGetFramebufferWidth(void); // Get default 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
|
// Types and Structures Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
#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 {
|
typedef struct rlglData {
|
||||||
rlRenderBatch *currentBatch; // Current render batch
|
rlRenderBatch *currentBatch; // Current render batch
|
||||||
rlRenderBatch defaultBatch; // Default internal render batch
|
rlRenderBatch defaultBatch; // Default internal render batch
|
||||||
|
|
||||||
|
rlglLoadProc loader; // OpenGL function loader
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int vertexCounter; // Current active render batch vertex counter (generic, used for all batches)
|
int vertexCounter; // Current active render batch vertex counter (generic, used for all batches)
|
||||||
float texcoordx, texcoordy; // Current active texture coordinate (added on glVertex*())
|
float texcoordx, texcoordy; // Current active texture coordinate (added on glVertex*())
|
||||||
@@ -1114,8 +1120,6 @@ typedef struct rlglData {
|
|||||||
} ExtSupported; // Extensions supported flags
|
} ExtSupported; // Extensions supported flags
|
||||||
} rlglData;
|
} rlglData;
|
||||||
|
|
||||||
typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions loader signature (same as GLADloadproc)
|
|
||||||
|
|
||||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
#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, " > Version: %s", glGetString(GL_VERSION));
|
||||||
TRACELOG(RL_LOG_INFO, " > GLSL: %s", glGetString(GL_SHADING_LANGUAGE_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)
|
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
// NOTE: Anisotropy levels capability is an extension
|
// NOTE: Anisotropy levels capability is an extension
|
||||||
#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
|
||||||
@@ -2625,6 +2631,11 @@ void rlLoadExtensions(void *loader)
|
|||||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
#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
|
// Get current OpenGL version
|
||||||
int rlGetVersion(void)
|
int rlGetVersion(void)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user