undefined reference glBindVertexArrayOES,glGenVertexArraysOES,glDeleteVertexArraysOES in eclipse

Trying to compile C++ code with Android NDK but these errors wont go away

undefined reference to glBindVertexArrayOES
undefined reference to glGenVertexArraysOES
undefined reference to glDeleteVertexArraysOES 

In .mk file wrote

LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lz  -landroid -lEGL

All other function are found perfectly, do i need to declare anything to make these work?

Upvotes: 4

Views: 6671

Answers (1)

Engin Manap
Engin Manap

Reputation: 21

This functions are not in base opengl es specification, so they are not defined by default, but offered as extensions.

If the device you use supports this extension, you can get the phsical address of the functions and use it by a function pointer.

it should be looking like this:

PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES;
PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES;
PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOES;
PFNGLISVERTEXARRAYOESPROC glIsVertexArrayOES;

glGenVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress ( "glGenVertexArraysOES" );
glBindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress ( "glBindVertexArrayOES" );
glDeleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress ( "glDeleteVertexArraysOES" );
glIsVertexArrayOES = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress ( "glIsVertexArrayOES" );

than you can use the functions. Just not forget this binding happens on runtime, so checking if this functions are supported is a good idea. If device does not support, the pointers will be 0.

Upvotes: 2

Related Questions