How do I pre preform bit operations in glsl? Using the regular C style bitwise operators |
, &
, ^
, or !
do not work.
views:
305answers:
2
A:
They have been introduced with GLSL 1.30 (ODL 3.0).
Depending on what you want to do, you could eventually emulate them with floating point operations, x & (2^n)-1 = frac(x/(2^n))*(2^n)
for example, but you'll have to take care of floating point errors.
Aszarsha
2009-11-09 13:16:30
A:
You need to put either
#version 130
or
#extension GL_EXT_gpu_shader4 : enable
in the top of your shader to get access to the bit operators
Chris Dodd
2009-12-21 07:29:51