I\'m trying to write some code that uses VAOs in C++ using the Android NDK to compile. I expect to be able to use glDeleteVertexArraysOES
, glGenVertexArra
The GLES2 library that gets included with NDK may only include the standard OpenGL ES 2.0 calls, without any extensions that may or may not be supported by each particular device/manufacturer/driver...
While most new devices support VAO, you may have to get the pointers to the functions yourself, or get a different binary library (you can extract it from your device, or from some ROM).
I had to resort to using this code to get the function pointers from the dylib:
//these ugly typenames are defined in GLES2/gl2ext.h
PFNGLBINDVERTEXARRAYOESPROC bindVertexArrayOES;
PFNGLDELETEVERTEXARRAYSOESPROC deleteVertexArraysOES;
PFNGLGENVERTEXARRAYSOESPROC genVertexArraysOES;
PFNGLISVERTEXARRAYOESPROC isVertexArrayOES;
void initialiseFunctions () {
//[check here that VAOs are actually supported]
void *libhandle = dlopen("libGLESv2.so", RTLD_LAZY);
bindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC) dlsym(libhandle,
"glBindVertexArrayOES");
deleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC) dlsym(libhandle,
"glDeleteVertexArraysOES");
genVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC)dlsym(libhandle,
"glGenVertexArraysOES");
isVertexArrayOES = (PFNGLISVERTEXARRAYOESPROC)dlsym(libhandle,
"glIsVertexArrayOES");
[...]
}
I define these function pointers inside a static object. There may be better ways of doing it, but this has worked for me so far.
Hope this helps.