Corrected web issue

This commit is contained in:
Ray 2019-05-14 18:02:11 +02:00
parent 7eb488a350
commit 3f7b14aeed

View file

@ -1559,8 +1559,6 @@ void rlglInit(int width, int height)
// NOTE: Only check on OpenGL ES, OpenGL 3.3 has VAO support as core feature // NOTE: Only check on OpenGL ES, OpenGL 3.3 has VAO support as core feature
if (strcmp(extList[i], (const char *)"GL_OES_vertex_array_object") == 0) if (strcmp(extList[i], (const char *)"GL_OES_vertex_array_object") == 0)
{ {
vaoSupported = true;
// The extension is supported by our hardware and driver, try to get related functions pointers // The extension is supported by our hardware and driver, try to get related functions pointers
// NOTE: emscripten does not support VAOs natively, it uses emulation and it reduces overall performance... // NOTE: emscripten does not support VAOs natively, it uses emulation and it reduces overall performance...
glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES"); glGenVertexArrays = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress("glGenVertexArraysOES");
@ -1568,19 +1566,9 @@ void rlglInit(int width, int height)
glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES"); glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress("glDeleteVertexArraysOES");
//glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES"); // NOTE: Fails in WebGL, omitted //glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES"); // NOTE: Fails in WebGL, omitted
if (glGenVertexArrays == NULL) printf("glGenVertexArrays is NULL.\n"); // WEB: ISSUE FOUND! ...but why? if ((glGenVertexArrays != NULL) && (glBindVertexArray != NULL) && (glDeleteVertexArrays != NULL)) vaoSupported = true;
if (glBindVertexArray == NULL) printf("glBindVertexArray is NULL.\n"); // WEB: ISSUE FOUND! ...but why?
} }
// TODO: HACK REVIEW!
// For some reason on raylib 2.5, VAO usage breaks the build
// error seems related to function pointers but I can not get detailed info...
// Avoiding VAO usage is the only solution for now... :(
// Ref: https://emscripten.org/docs/porting/guidelines/function_pointer_issues.html
#if defined(PLATFORM_WEB)
vaoSupported = false;
#endif
// Check NPOT textures support // Check NPOT textures support
// NOTE: Only check on OpenGL ES, OpenGL 3.3 has NPOT textures full support as core feature // NOTE: Only check on OpenGL ES, OpenGL 3.3 has NPOT textures full support as core feature
if (strcmp(extList[i], (const char *)"GL_OES_texture_npot") == 0) texNPOTSupported = true; if (strcmp(extList[i], (const char *)"GL_OES_texture_npot") == 0) texNPOTSupported = true;