views:

107

answers:

1

I'm running some experiments in WebGL, one of them being an XOR effect fragment shader. For some reason all the bitwise operators are reserved in GLSL and cause a compiler error when used. Why are these operators illegal? What can I use instead of | in this case?

+1  A: 

In the GLSL 1.0 spec, they were reserved "for future use", which was the 1.3 spec. It's allowed for unsigned and signed integers, both scalar and vector.

You should begin your shader by

#version 130
Calvin1602
Thanks, I guess version 1.3 is not supported on Chromium's webgl, as I'm getting the error 'Version number not supported by ESSL'
efnx clckclcks
Most of the time, you can workaround xor with if() : i=0; if(cond1) i++; if(cond2) i++; if (i==1)....
Calvin1602