I am filling a 2D texture with GLubyte from floating point values of R (real numbers) mapped to (0,1) and multiplied by 255 giving values (0, 255). Saving is as GL\_R8 as I only need 1 value from the texture. This can for example represent a mathematical function. 

I also upload a 1d texture to work as a colormap/colorbar. I then sample from the 1D texture based on the values from my 2D texture.

This is how my fragment shaders works:

```
#version 400
in vec2 f_textureCoord;

layout(location = 0) out vec4 FragColor;

uniform sampler2D textureData;
uniform sampler1D colorBar;

void main() {
    /* Values in the sampler are on (0, 1) * 255 => (0, 255) */
    vec3 texColor = texture2D(textureData, f_textureCoord).rgb;
    float s = texColor.r;

    /* Use the texture value as a coordinate in the 1D colorbar texture */
    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 are:

1) Why do I get this error/warning? --- *Answered in comments...*

2) Is this the correct approach to what I am trying to do? Should I use another form of buffer instead of saving my function values in a 2D texture?

3) I assume that I will run into problems when my math function (filling the 2D texture) exceeds some texture size limit. Any recommendations on how I should proceed to work around this?