texelFetch(sampler1D(0),0,0);
This is not legal GLSL.
sampler1D
is an opaque type. It does not have a value of any kind. Yes, I know you "set" a value with glUniform1i
, but you're not really setting a value. sampler1D
cannot be constructed. This is a list of everything you can do with a sampler type in GLSL:
- Declare it as a uniform variable at global scope.
- Declare it as an input function parameter.
- Pass a variable of sampler type to a function that takes that sampler type as an argument.
Note that "call a constructor" is not on that list. sampler1D(0)
is not proper syntax. If you want to use a sampler, you need to declare it as a uniform and set the texture image unit from OpenGL source code. Or use the layout(binding=#)
syntax, if you have GL 4.2 or ARB_shading_language_420pack.
The true is that I want it for performance.
Then you are wanting it for the wrong reasons. You use texelFetch
when texelFetch
most accurately describes what you are trying to do. It is not merely "unfiltered"; you can get that simply by setting the texture/sampler parameters properly. You should use it when you want access to a specific texel, without texture coordinate normalization and so forth.