A
Anthony Navarro
Guest
Hello, I am having some trouble using a shader in my game.
I am relatively new to GLSL, so any help would be appreciated.
My goal: I want a shader to draw the bottom portion of a sprite, and work its way up.
I want the colors to be inverted, so the end result (for a white block) would look like
a black block is moving up to cover the white block. Hopefully this all makes sense. I
was able to make the color inversion easily enough, but I havent been able to get the inversion to rise instead of being drawn all at once. I have tried things like:
This always draws the inversion over the entire image at once, even though the "time"
uniform is decremented slowly (starting at 1). It is my understanding that v_vTexCoord coordinates are non-linear (0-1)
Maybe im wrong. Im definitely screwing something up.
Thanks in advance for any suggestions!
I am relatively new to GLSL, so any help would be appreciated.
My goal: I want a shader to draw the bottom portion of a sprite, and work its way up.
I want the colors to be inverted, so the end result (for a white block) would look like
a black block is moving up to cover the white block. Hopefully this all makes sense. I
was able to make the color inversion easily enough, but I havent been able to get the inversion to rise instead of being drawn all at once. I have tried things like:
Code:
if(1.0-v_vTexCoord.y<time)
{
//invert
}else{
//use regular color
}
uniform is decremented slowly (starting at 1). It is my understanding that v_vTexCoord coordinates are non-linear (0-1)
Maybe im wrong. Im definitely screwing something up.
Thanks in advance for any suggestions!