i have a question about glsl debugging. i know i need to output certain value as a color, but how do you do the conversion between a value and a color?
normally i do this, gl_color=vec4(a/k,0,0,1);
where “a” is the value i want to check
and “k” is some value that is known to be twice as the correct value of “a”
and then i make a screenshot of the rendered result and check if the color value is (127,0,0);
but this is not accurate, because i’m not using all the 3 channels of the color, the outputted value can only be between 0-255.
in a normal c++ program, i do this conversion to make use of all the channels of a color vector:
struct COLORID intToColor(int _in)
struct COLORID result;
result=*((struct COLORID*)(void *)&_in); return result;
but in a shader program, i’m not allowed to use pointer, so how can i do this conversion?