Search code examples
openglglslopengl-3fragment-shader

Fragment shader for unsigned integer textures


I am using following shader for unsigned integer textures to read a data: Fragment shader:

Code :

#version 150
out uvec4 fragColor;
uniform uint factor;
void main()
{
uint temp=factor;
temp=temp/2;
fragColor = uvec4(temp,temp,temp,temp);
}

But i am getting error on driver A:

"Compile failed. ERROR: 0:7: '/' : Wrong operand types. No operation '/' exists that takes a left-hand operand of type 'uint' and a right operand of type 'const int' (and there is no acceptable conversion) ERROR: 1 compilation errors. No code generated."

on driver B it runs perfectly. Is driver A is buggy or my shader is wrong? if wrong, how can i achieve the same result?


Solution

  • Try this:

    temp = temp / uint(2);