I fill in the GLubyte 2D texture from the floating point values ββR (real numbers) displayed in (0,1) and multiply by 255 to give the values ββ(0, 255). Saving is like GL_R8, since I need only one value from the texture. This may be, for example, a mathematical function.
I also upload 1d texture to work as a color map / colorbar. Then I select from 1D texture based on the values ββfrom my 2D texture.
This is how my fragment shaders work:
#version 400 in vec2 f_textureCoord; layout(location = 0) out vec4 FragColor; uniform sampler2D textureData; uniform sampler1D colorBar; void main() { vec3 texColor = texture2D(textureData, f_textureCoord).rgb; float s = texColor.r; vec3 color = texture1D(colorBar, s).rgb; float val = color.r; FragColor = vec4(val, val, val, 1); }
Using this, I get the following error:
glValidateProgram: validation error: samplers of different types point to the same texture unit
However, my code works as expected, at least the rendering result!
My questions:
1) Why am I getting this error / warning? --- Answered in the comments ...
2) Is this the right approach to what I'm trying to do? Should I use a different form of buffer instead of storing the values ββof my function in a 2D texture?
3) I assume that I will have problems when my mathematical function (filling in a 2D texture) exceeds a certain size limit of the texture. Any recommendations on how I should work on this?
source share