如何在Android上启用OpenGL扩展GL_EXT_shader_framebuffer_fetch? [英] How to enable OpenGL extension GL_EXT_shader_framebuffer_fetch on Android?
问题描述
我正在用OpenGL ES 2.0开发一个Android应用,我想使用
I'm developing an Android app with OpenGL ES 2.0 and I'd like to use the GL_EXT_shader_framebuffer_fetch extension.
据我了解,我需要先使用片段着色器顶部的 #extension
指令启用它,然后才能使用内置变量 gl_LastFragData 代码>.
From what I understand, I need to enable it first with the #extension
directive at the top of my fragment shader, and then I can use the built-in variable 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;
}
但是,当我编译着色器时,出现以下编译错误:
However, when I compile the shader, I get the following compilation error:
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.
错误非常明显:不支持此扩展 .
The error is pretty explicit: this extension is not supported.
我的技术规格:
- 硬件:三星Galaxy S4
- Android版本:5.0.1
- Android API级别:21
- OpenGL版本(
glGetString(GL_VERSION)
):OpenGL ES 3.0 V@84.0 AU @(CL @)
- Hardware: Samsung Galaxy S4
- Android version: 5.0.1
- Android API level: 21
- OpenGL version (
glGetString(GL_VERSION)
): OpenGL ES 3.0 V@84.0 AU@ (CL@)
我有几个问题:
- 我可以在设备上安装该扩展程序吗?
- 如果没有,我可以在模拟器上安装/使用它吗?
- 是软件问题还是真正的硬件问题?
- Is there anything I can do to install this extension on my device?
- If not, can I install it/use it on an emulator?
- Is it a software matter or really a hardware problem?
推荐答案
我可以做些什么来在设备上安装此扩展程序吗?
Is there anything I can do to install this extension on my device?
否;GPU和驱动程序支持它,或者它们不支持.
No; either the GPU and driver support it, or they don't.
如果没有,我可以在模拟器上安装/使用它吗?
If not, can I install it/use it on an emulator?
如果仿真器支持扩展名,那么可以使用它...
If the emulator supports the extension, then yes you can use it ...
是软件问题还是硬件问题?
Is it a software matter or really a hardware problem?
可能是基础硬件的限制,也可能是驱动程序的限制.从应用程序开发人员的角度来看,两者是不可分割的,因此这是无关紧要的,这实际上是限制...
Could be either a limitation in the underlying hardware, or a limitation in the driver. From an app developer point of view the two are indivisible, so it's sort of irrelevant which is the limitation really ...
这篇关于如何在Android上启用OpenGL扩展GL_EXT_shader_framebuffer_fetch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!