c++ - How to get OpenGL VAO related functions to compile under Emscripten? -


i'm trying port code gl 3.x compile , work emscripten, though em++ doesn't find glgenvertexarrays() , related funcs (i don't know why, maybe not part of gles api), so, following example code, reached possible solution:

#ifdef __xf_target_opengles #include <dlfcn.h> typedef void(*glgenvertexarraystype) (glsizei n, gluint *arrays); glgenvertexarraystype glgenvertexarraysfunc = nullptr; #define glgenvertexarrays glgenvertexarraysfunc typedef void(*gldeletevertexarraystype) (glsizei n, gluint *arrays); gldeletevertexarraystype gldeletevertexarraysfunc = nullptr; #define gldeletevertexarrays gldeletevertexarraysfunc typedef void(*glbindvertexarraytype) (gluint array); glbindvertexarraytype glbindvertexarrayfunc = nullptr; #define glbindvertexarray glbindvertexarrayfunc #endif // __xf_target_opengles 

and later...

void vao::create() { #ifdef __xf_target_opengles     if (glgenvertexarrays == nullptr && !mvaochecked)     {         glgenvertexarrays = (glgenvertexarraystype)dlsym(rtld_default, "glgenvertexarrays");         gldeletevertexarrays = (gldeletevertexarraystype)dlsym(rtld_default, "gldeletevertexarrays");         glbindvertexarray = (glbindvertexarraytype)dlsym(rtld_default, "glbindvertexarray");          mvaochecked = true;         mvaosupported = glgenvertexarrays != nullptr;          if (!mvaosupported)         {             xf_consolelog(loglevel::xf_loglevel_warning) << "opengl vao not supported!!!" << std::endl;         }     } #else     mvaochecked = true;     mvaosupported = true; #endif // __xf_target_opengles      if (mvaochecked && mvaosupported)     {         glgenvertexarrays(1, &marrayid);         xf_check_opengl_error(__line__);     } } 

problem is, dlsym() doesn't correct proc address. not know i'm doing wrong or if right way acheive need...

any appreciated.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -