I have two textures I need to process in a shader (depth maps). One is float, the other is short (integer).
Can I do some kind of type conversion? Or are shaders able to compare floats and ints?
I have two textures I need to process in a shader (depth maps). One is float, the other is short (integer).
Can I do some kind of type conversion? Or are shaders able to compare floats and ints?
In GLSL you can cast using the type, for instance:
int value = int(float_value);
or for vectors:
vec4 vector = vec4(3d_vector, float(integer));
It’s quite smart in that manour.