小编vis*_*ran的帖子

'texelFetch':在 opengl es 3.0 中找不到匹配的重载函数

我正在使用OpenGL es 3.0和我的 GLSL 版本#version 300 es

我正在尝试计算 GPU 中的发光直方图。我已经确定我的设备支持顶点纹理获取并尝试使用 texelFetch 函数读取顶点着色器中的颜色信息。我使用 texelFetch 是因为我传入每个纹理坐标以便读取每个像素的颜色信息。

附上代码

#version 300 es 
uniform sampler2D imageTexture;
in vec2 texturePosition;
const float SCREEN_WIDTH = 1024.0;
in vec4 position;
vec2 texturePos;
out vec3 colorFactor;
const vec3 W = vec3(0.299, 0.587, 0.114); 
void main() {
    texturePos = texturePosition / SCREEN_WIDTH;
    vec3 color = texelFetch(imageTexture, texturePos.xy,0).rgb;
    float luminance = dot(color.xyz,W);
    colorFactor = vec3(1.0, 1.0, 1.0);
    gl_Position = vec4(-1.0 + (luminance *  0.00784313725), 0.0, 0.0, 1.0); …
Run Code Online (Sandbox Code Playgroud)

android opengl-es glsl

5
推荐指数
1
解决办法
1853
查看次数

标签 统计

android ×1

glsl ×1

opengl-es ×1