ive changed the line
Quote: "WriteLine(file,"gl_FragColor = (texture2D(texture0, uvVarying) + texture2D(texture1, uvVarying))/2.0;")"
to
gl_FragColor = (texture2D(texture0, uvVarying) + (2.0*.5*texture2D(texture1, uvVarying)))/2.0;
where .5 is a percentage that seemed to work
the main problem I was having was setting the variable from the program but I fixed that thanks

with the following which converts one texture to another gradually on an object
+ Code SnippetSetWindowSize( 1024, 768, 0 )
SetVirtualResolution( 1024, 768 )
// create a sphere to see the texture
CreateObjectSphere(1,20,40,60)
//CreateObjectplane(1,1024,768)
// position and orientate the camera
SetCameraPosition(1,0,100,-200)
SetCameraLookAt(1,0,0,0,0)
SetGenerateMipmaps(1)
LoadImage(1,"texture.jpg") // no need for alpha with this one
LoadImage(2,"texture2.png") // with alpha ;)
CreatePointLight(1,-5,5,5,500,200,200,200)
// initial rotation values
angle_x# = 0.0
// main loop
SetObjectRotation(1,-60,-60,0.0)
SetObjectScale(1,4,2,2)
createShader()
LoadShader(3, "vertex.vs", "fragment.ps")
SetObjectShader(1,3)
SetObjectImage(1,1,0)
SetObjectImage(1,2,1)
perc#=.1:time#=Timer()
do
angle_x# = angle_x# + 1
SetShaderConstantByName(3,"Percentage",perc#,0.0,0.0,0.0)
SetObjectRotation(1,0, angle_x#,0.0)
if perc#<=1 and time#>.1
perc#=perc#+.01
ResetTimer()
endif
SetSpriteImage(1,2)
time#=Timer()
sync()
loop
function createShader()
file = OpenToWrite("vertex.vs")
WriteLine(file,"attribute vec3 position;")
WriteLine(file,"attribute vec2 uv;")
WriteLine(file,"varying vec2 uvVarying;")
WriteLine(file,"uniform vec4 uvBounds0;")
WriteLine(file,"uniform mat4 agk_World;")
WriteLine(file,"uniform mat4 agk_ViewProj;")
WriteLine(file,"void main()")
WriteLine(file,"{")
WriteLine(file,"vec4 pos = agk_World * vec4(position,1);")
WriteLine(file,"gl_Position = agk_ViewProj * pos;")
WriteLine(file,"uvVarying = uv * uvBounds0.xy + uvBounds0.zw;")
WriteLine(file,"}")
CloseFile(file)
file = OpenToWrite("fragment.ps")
WriteLine(file,"uniform sampler2D texture0;")
WriteLine(file,"uniform sampler2D texture1;")
WriteLine(file,"uniform float Percentage;")
WriteLine(file,"varying vec2 uvVarying;")
WriteLine(file,"void main()")
WriteLine(file,"{")
WriteLine(file,"gl_FragColor = (texture2D(texture0, uvVarying) + (4.0*Percentage*texture2D(texture1, uvVarying)))/2.0;")
//WriteLine(file,"gl_FragColor = gl_FragColor+(10.0/1.0*texture2D(texture1, uvVarying));")
WriteLine(file,"}")
CloseFile(file)
endfunction