Browse Source

REVIEWED: Define instancing API entry points for RPI

raysan5 4 years ago
parent
commit
434a3a276d
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/rlgl.h

+ 8 - 4
src/rlgl.h

@@ -731,6 +731,14 @@ RLAPI Texture2D rlGenTextureBRDF(Shader shader, int size);              // Gener
     #include <EGL/egl.h>                // EGL library
     #include <GLES2/gl2.h>              // OpenGL ES 2.0 library
     #include <GLES2/gl2ext.h>           // OpenGL ES 2.0 extensions library
+    
+    // It seems OpenGL ES 2.0 instancing entry points are not defined on Raspberry Pi 
+    // provided headers (despite being defined in official Khronos GLES2 headers)
+    #if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
+    typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+    typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+    typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
+    #endif
 #endif
 
 //----------------------------------------------------------------------------------
@@ -892,15 +900,11 @@ static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
 static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
 static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL;
 
-// It seems OpenGL ES 2.0 instancing entry points are not defined
-// in Raspberry Pi provided headers (despite being defined in official Khronos GLES2 headers)
-#if !defined(PLATFORM_RPI) && !defined(PLATFORM_DRM)
 // NOTE: Instancing functionality could also be available through extension
 static PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstanced = NULL;
 static PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstanced = NULL;
 static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL;
 #endif
-#endif
 
 //----------------------------------------------------------------------------------
 // Module specific Functions Declaration