6

我想在我的 Android 原生 c 应用程序中使用 VAO。

问题是,这GL_OES_vertex_array_object是支持的,我什至可以得到地址,glBindVertexArrayOESglDeleteVertexArraysOES找不到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" );
}

我当然收到日志消息

无法获取 proc 地址: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)

设备型号 Samsung i9003 与 Android 2.3.5

4

2 回答 2

3

我刚刚测试了这个......

代替:

#include <GLES2/gl2ext.h>

有了这个:

#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2ext.h>

必须在包含 gl2ext.h 之前定义宏 GL_GLEXT_PROTOTYPES。无需明确定义功能。

于 2016-01-07T02:26:02.090 回答
2

如果那真的是您的代码,那么错误是您缺少“!”。相比:

if ( !glDeleteVertexArraysOES )

if ( glGenVertexArraysOES )
于 2013-10-18T03:45:44.667 回答