Hello.
I want to control the way opengl blend transparent surfaces.
Vertex shader
#version 120
varying vec2 texcoord;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
texcoord = gl_MultiTexCoord0.xy;
}
Fragment shader
#version 120
uniform sampler2D img;
varying vec2 texcoord;
void main()
{
vec4 tex = texture2D ( img, texcoord );
gl_FragColor = tex;
}
Those are my basic texture rendering codes.
What i need is to get somehow the pixel what is behind that thing what is correctly in shader.
It would be so good to have control over it.
Also readed the basics of shaders, did not get any ideas how to do it.
Reading on internet, they said that opengl offers some blend functions. Already tried them.
Its nothing wrong with them but the way they act doesnt pleasure me. I really need to controll how pixels are blended.
Is there someone wise who have solution to my problem?
Thanks!