Hello,
I want to read a texture from the vertex shader using texelFetch
, but it fails to compile with the following error: ‘‘texelFetch’ : no matching overloaded function found’.
Any idea of what’s wrong?
Here is the code of my vertex shader:
uniform sampler2D tex;
attribute float vertexID;
void main() {
int id = int(vertexID);
ivec2 p0 = ivec2(id, 0);
vec3 vertex = texelFetch(tex, p0, 0).rgb; // also tried with texelFetch(tex, p0);
gl_Position = projectionMatrix * modelViewMatrix * vec4( vertex, 1.0 );
}
And the texture is a DataTexture, RGB with FloatType. Also interesting: it works with texture2D()…
Any help is appreciated