我想在Android的native-c应用程序中使用VAO。
问题是,支持GL_OES_vertex_array_object
,我甚至可以获得glBindVertexArrayOES
和glDeleteVertexArraysOES
的地址,但找不到glGenVertexArraysOES
。
GL_OES_vertex_array_object
的存在是否意味着可以访问所有这些功能?
我的VAO初始化代码:
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" );
}
当然我收到了日志消息
Can't get proc address: glGenVertexArraysOES
我的Android.mk
(缩短了一点):
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)
设备型号三星i9003与Android 2.3.5
答案 0 :(得分:2)
如果这真的是你的代码,那么错误是你错过了'!'。比较:
if ( !glDeleteVertexArraysOES )
到
if ( glGenVertexArraysOES )
答案 1 :(得分:1)
我刚试过这个......
替换:
int main(int argc, char * argv[])
有了这个:
#include <GLES2/gl2ext.h>
在包含gl2ext.h之前,必须定义宏GL_GLEXT_PROTOTYPES。 没有必要明确定义函数。