Gomu.Wang
05-28-2010, 05:12 AM
Hi guys~
I'm doing some experiments these days and here is a question:
We assume that there are two vertexes have the same position(which means the fragments overlaped) but different texture coordinate.
Then how can I get the two fragment output data add up?
For example, vertex1 and vertex2 have same position(so they will be sent to the same fragment position) and they have output value '10' and '20' respectively.
How can I get '30' in the renderbuffer after shading?
Here is the fragment code:
#extension GL_EXT_gpu_shader4 : enable
varying out uvec4 FragOut;
uniform usampler2D Tex1;
void main(void) {
uvec4 texel = texture2D(Tex1,gl_TexCoord[0].st);
FragOut = texel;
}
If the data is simply float gl_FragCOlor, we can use GL_BLEND to achieve the addition. But now FragOut are integers so we cannot use blend function.
Thank you very much!
I'm doing some experiments these days and here is a question:
We assume that there are two vertexes have the same position(which means the fragments overlaped) but different texture coordinate.
Then how can I get the two fragment output data add up?
For example, vertex1 and vertex2 have same position(so they will be sent to the same fragment position) and they have output value '10' and '20' respectively.
How can I get '30' in the renderbuffer after shading?
Here is the fragment code:
#extension GL_EXT_gpu_shader4 : enable
varying out uvec4 FragOut;
uniform usampler2D Tex1;
void main(void) {
uvec4 texel = texture2D(Tex1,gl_TexCoord[0].st);
FragOut = texel;
}
If the data is simply float gl_FragCOlor, we can use GL_BLEND to achieve the addition. But now FragOut are integers so we cannot use blend function.
Thank you very much!