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

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

问题描述

根据Khronos OpenGL ES Registry,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 <GLES2/gl2.h>,给出以下错误*(我正在使用 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-r10eplatformsandroid-19arch-armusrincludeGLES2gl2ext.h(6): includes this header: 
C:android-ndk-r10eplatformsandroid-19arch-armusrincludeGLES2gl2.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-r10eplatformsandroid-19arch-armusrincludeGLES3gl3.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 更改为 GLES 3.0 核心.这是 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?

推荐答案

根据 Michael 的评论,我发现这在 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时,定义的include保护会导致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天全站免登陆