I want to use VAO in my native-c application for Android.
The problem is, that GL_OES_vertex_array_object
is supported and I can even get the addresses of glBindVertexArrayOES
and glDeleteVertexArraysOES
but glGenVertexArraysOES
is not found.
Does the presence of GL_OES_vertex_array_object
mean that all these functions can be accessed?
My code for VAO initialization:
std::string vao = "GL_OES_vertex_array_object";
if ( isExtensionSupported ( vao.c_str () ) != 0 )
{
LOG ( vao << " supported" );
glBindVertexArrayOES = (PFNGLBINDVERTEXARRAYOESPROC)eglGetProcAddress ( "glBindVertexArrayOES" );
if ( !glBindVertexArrayOES )
LOG ( "Can't get proc address: glBindVertexArrayOES" );
glDeleteVertexArraysOES = (PFNGLDELETEVERTEXARRAYSOESPROC)eglGetProcAddress ( "glDeleteVertexArraysOES" );
if ( !glDeleteVertexArraysOES )
LOG ( "Can't get proc address: glDeleteVertexArraysOES" );
glGenVertexArraysOES = (PFNGLGENVERTEXARRAYSOESPROC)eglGetProcAddress ( "glGenVertexArraysOES" );
if ( glGenVertexArraysOES )
LOG ( "Can't get proc address: glGenVertexArraysOES" );
}
else
{
LOG ( vao << " not supported" );
}
Of course I get the log message
Can't get proc address: glGenVertexArraysOES
My Android.mk
(shortened a little bit):
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := smart
LOCAL_SRC_FILES := Base/Node.cpp
...
LOCAL_LDLIBS := -llog -landroid -lGLESv2 -lEGL
LOCAL_STATIC_LIBRARIES := nv_and_util
include $(BUILD_SHARED_LIBRARY)
$(call import-add-path, C:/NVPACK/TDK_Samples/tegra_android_native_samples_v10p00/libs/jni)
$(call import-module,nv_and_util)
Device model Samsung i9003 with Android 2.3.5
I just tested this....
Replace:
#include <GLES2/gl2ext.h>
With this:
#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2ext.h>
The macro GL_GLEXT_PROTOTYPES must be defined before you include gl2ext.h. There is no need to define the functions, explicitly.
If that's really your code, then the bug is you're missing a '!'. Compare:
if ( !glDeleteVertexArraysOES )
to
if ( glGenVertexArraysOES )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With