4

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?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • Have you considered that your implementation of OpenGL ES doesn't support OES_vertex_array_object? – Nicol Bolas Jan 18 '13 at 20:10
  • 1
    In glext.h i see GL_API void GL_APIENTRY glBindVertexArrayOES (GLuint array); GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); – Suvitruf - Andrei Apanasik Jan 18 '13 at 20:12

1 Answers1

2

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.