GLES 3.0,包括gl2ext.h [英] GLES 3.0 including gl2ext.h

查看:2258
本文介绍了GLES 3.0,包括gl2ext.h的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照的Khronos OpenGL ES的注册,为GLES 3.0的扩展头居然是< GLES2 / gl2ext.h> gl3ext.h 应该是空的,只有对传统兼容。因此,如果你想包括GLES 3.0头,你应该做的:

According to the Khronos OpenGL ES Registry, the extension header for GLES 3.0 is actually <GLES2/gl2ext.h>. gl3ext.h should be empty and provided only for legacy compatibility. Thus, if you want to include GLES 3.0 headers, you should do:

#include <GLES3/gl3.h>
#include <GLES2/gl2ext.h>

不过,与Android NDK编译,看来该版本的 gl2ext.h 内部确实的#include&LT的; GLES2 / GL2。 H&GT; ,给下面的错误*(我与API-19编译):

However, compiling with the Android NDK, it appears that that version of the gl2ext.h internally does #include <GLES2/gl2.h>, giving the following error *(I am compiling with API-19):

C:\android-ndk-r10e\platforms\android-19\arch-arm\usr\include\GLES2\gl2ext.h(6): includes this header: 
C:\android-ndk-r10e\platforms\android-19\arch-arm\usr\include\GLES2\gl2.h(572,37): error : conflicting types for 'glShaderSource'
GL_APICALL void         GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
                                    ^
C:\android-ndk-r10e\platforms\android-19\arch-arm\usr\include\GLES3\gl3.h(905,39):  note: previous declaration is here
GL_APICALL void           GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);

这是因为 glShaderSource 的原型来自GLES 2.0改为3.0 GLES核心。这是glext头了Android NDK版本错误,或者我不能做一些正确?

This is because the prototype of glShaderSource changed from GLES 2.0 to GLES 3.0 core. Is this an error in the Android NDK version of the glext headers, or am I not doing something properly?

推荐答案

根据迈克尔的评论,我发现,这是固定的API-21。但是,如果你仍然需要使用API​​-18或API-19,有一个变通。你可以简单的:

Based on Michael's comments, I've found that this is fixed in API-21. However, if you still need to use API-18 or API-19, there is a work-around. You can simply:

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

在gl2ext.h包括gl2.h,定义包括守卫会造成gl2.h的内容被跳过。

When gl2ext.h includes gl2.h, the defined include guard will cause the contents of gl2.h to be skipped.

这篇关于GLES 3.0,包括gl2ext.h的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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