I have the following problem. I've written a shader that takes in two textures and one float.
The first texture is my particle texture, the second is a gradient, which is 100x1.
Now I want to mix the color from a certain point from the gradient into the particle texture.
I've tested this in Render Monkey and it works, however it does not work in my render demo.The aim is to create a fireworks like effect.
Here are the sources for vert and frag shaders, where tex is particle texture, tex2 is the gradient and grad is a value from 0.0 to 1.0.
vert:
void main(void){ gl_Position = ftransform();}
frag:
uniform sampler2D tex;uniform sampler2D tex2;uniform float grad;void main(void){ vec4 color = texture2D(tex,gl_PointCoord); vec4 color2 = texture2D(tex2, vec2(grad,1)); color.w *= (1.0 - grad); // Alpha, the particle becomes gradually more transparent color.xyz *= color2.xyz; // multiplying the RGB values gl_FragColor = color;}
It seems like I'm not getting the color from tex2 aka the gradient.
[Edited by - Corefanatic on August 10, 2010 12:46:25 PM]