eclipse中未定义的参考glBindVertexArrayOES、glGenVertexArraysOES、glDeleteVertexArraysOES [英] undefined reference glBindVertexArrayOES,glGenVertexArraysOES,glDeleteVertexArraysOES in eclipse

查看:15
本文介绍了eclipse中未定义的参考glBindVertexArrayOES、glGenVertexArraysOES、glDeleteVertexArraysOES的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 Android NDK 编译 C++ 代码,但这些错误不会消失

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 

在.mk文件中写了

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?

推荐答案

此函数不在基本opengl es规范中,因此默认情况下未定义,但作为扩展提供.

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.

它应该是这样的:

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

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

比你可以使用的功能.只是不要忘记此绑定发生在运行时,因此检查是否支持此功能是一个好主意.如果设备不支持,则指针为0.

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.

这篇关于eclipse中未定义的参考glBindVertexArrayOES、glGenVertexArraysOES、glDeleteVertexArraysOES的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆