我開發一個Android應用程序與OpenGL ES 2.0的,我想用GL_EXT_shader_framebuffer_fetch擴展。如何在Android上啓用OpenGL擴展GL_EXT_shader_framebuffer_fetch?
根據我的理解,我需要先使用我的片段着色器頂部的#extension
指令啓用它,然後我可以使用內置變量gl_LastFragData
。
因此,這裏是我的片段着色器:
#extension GL_EXT_shader_framebuffer_fetch : require
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- Enable the extension
varying highp vec2 textureCoords;
uniform sampler2D currentTexture;
void main()
{
vec4 currentColor = texture2D(currentTexture, textureCoords);
gl_FragColor = currentColor;
}
然而,當我編譯着色器,我得到以下編譯錯誤:
Couldn't compile shader: Fragment shader compilation failed.
ERROR: 0:1: '' : GLSL error: extension 'GL_EXT_shader_framebuffer_fetch' is not supported
ERROR: 1 compilation errors. No code generated.
的錯誤是很明確的:這個擴展不支持。
我的技術規格:
- 硬件:三星Galaxy S4
- Android版本:5.0.1
- Android的API級別:21
- 的OpenGL版本(
glGetString(GL_VERSION)
):OpenGL ES 3.0 [email protected] AU @(CL @)
我有幾個問題:
- 有什麼我可以做安裝這個擴展我的設備上?
- 如果沒有,我可以安裝/使用它的模擬器?
- 是不是軟件事情還是真的有硬件問題?