kupo15
Member
I can't seem to find much documentation on using integers. I learned how to do a dynamic pallet swap system using floats that work fine but am having trouble converting it to an integer system since color data is typically 0-255 in paint programs. Here is my float point code
I tried simply changing all float numbers to integers and using shader_set_uniform_i instead...the program compiles but the alpha seems to be at 0 as the pixels its supposed to be affecting are transparent.
What am I missing?
Code:
// create
red_value = 1.0;
green_value = 1.0;
blue_value = 1.0;
Code:
// draw
shader_set(shader0);
var ss = shader_get_uniform(shader0,"colors");
shader_set_uniform_f(ss,red_value,green_value,blue_value,1.0);
draw_sprite(sprite5,0,x,y);
shader_reset();
Code:
// shader0
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec4 colors;
void main()
{
vec4 Color = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
// get the pixel color data
float red = Color.r;
float green = Color.g;
float blue = Color.b;
float alph = Color.a;
if (Color.r == 1.0 && green == 0.0 && blue == 0.0 && alph > 0.0)
gl_FragColor = colors;
else
gl_FragColor = Color;
}
I tried simply changing all float numbers to integers and using shader_set_uniform_i instead...the program compiles but the alpha seems to be at 0 as the pixels its supposed to be affecting are transparent.
What am I missing?