but here it is dissolve or make colors brighter
+ Code SnippetSetWindowSize( 1024, 768, 0 )
SetVirtualResolution( 1024, 768 )
LoadImage(1,"texture1.jpg")
createShader()
CreateSprite(1,1)
LoadSpriteShader(1, "dissolve.ps")
SetSpriteShader( 1,1 )
resetTimer()
do
time#=Timer()
//SetShaderConstantByName(1,"myColor",-time#-,time#,-time#,0.2) //this will make the channels brighter
SetShaderConstantByName(1,"myColor",time#,time#,time#,0.2) //red green blue factor
if Timer()>7.0
resetTimer()
endif
print (time#)
sync()
loop
function createShader()
file = OpenToWrite("dissolve.ps")
WriteLine(file,"uniform sampler2D texture0;")
//WriteLine(file,"uniform float agk_time;")
WriteLine(file,"varying mediump vec2 uvVarying;")
WriteLine(file,"uniform vec4 myColor;")
WriteLine(file,"void main()")
WriteLine(file,"{")
WriteLine(file,"vec4 color = texture2D(texture0, uvVarying).rgba;")
WriteLine(file,"//color=color-vec4(100.0/255.0);") // (no branching) make 255 steps as the color in shaders go from 0 to 1
WriteLine(file,"color.r-=(myColor.x*myColor.w);")
WriteLine(file,"color.g-=(myColor.y*myColor.w);")
WriteLine(file,"color.b-=(myColor.z*myColor.w);")
WriteLine(file,"color = clamp(color,0.0,1.0);") //restricts color range
WriteLine(file,"gl_FragColor = color;")
WriteLine(file,"}")
CloseFile(file)
endfunction
if you change the code in the program to read something like this it will gradually turn the screen to that color
+ Code Snippettime#=Timer()
r#=time#*(255/255) //red (colors you want divided by 255)
g#=time#*(255/255) //green
b#=time#*(0/255) //Blue makes yellow rgb (255,255,0)
SetShaderConstantByName(1,"myColor",-r#,-g#,-b#,0.2) //red green blue factor
and the reverse can be done like make a black screen merge in to your sprite similar but different to doing it with alpha
+ Code Snippettime#=7-Timer()
r#=time#
g#=time#
b#=time#
if timer()<7.0
SetShaderConstantByName(1,"myColor",r#,g#,b#,0.2) //red green blue factor
endif
The main problem I was having I wasn't declaring my variables to be uniform and ended trying so many crazy things
before I realized and the other issue I had was I didn't realize I had to keep changing the amount value to match
what I wanted, I thought I could just subtract a value and if I kept calling the shader it would keep doing it as the texture
would be modified boy was I wrong lol