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:
根据Khronos OpenGL ES注册表,GLES 3.0的扩展头实际上是
#include <GLES3/gl3.h>
#include <GLES2/gl2ext.h>
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):
然而,用Android NDK编译,似乎是gl2ext的版本。内部做#include
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);
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?
这是因为glShaderSource的原型从GLES 2.0更改为GLES 3.0核心。这是Android NDK版本的glext文件的错误,还是我做的不好?
1 个解决方案
#1
6
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:
根据Michael的评论,我发现这是固定在API-21。但是,如果您仍然需要使用API-18或API-19,那么有一个变通方法。你可以简单的:
#define __gl2_h_
#include <GLES2/gl2ext.h>
When gl2ext.h includes gl2.h, the defined include guard will cause the contents of gl2.h to be skipped.
当gl2ext。h包括gl2。h,所定义的包含保护将导致gl2的内容。h是跳过。
#1
6
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:
根据Michael的评论,我发现这是固定在API-21。但是,如果您仍然需要使用API-18或API-19,那么有一个变通方法。你可以简单的:
#define __gl2_h_
#include <GLES2/gl2ext.h>
When gl2ext.h includes gl2.h, the defined include guard will cause the contents of gl2.h to be skipped.
当gl2ext。h包括gl2。h,所定义的包含保护将导致gl2的内容。h是跳过。