I would like to draw triangles (with the same Y - up direction - value), which ones may intersect each other. When I draw it with alpha value, I see darker blobs.
How can I resolve it?
screenshot:: http://delfin.unideb.hu/~fazekaim/problem.jpg
I have a plane quad (in red colors), and above the quad a lot of randomly generated triangles with the same Y(up direction) value.
I would guess that you have messed up the winding order of some of the traiangles, some are clockwise and some are counter clockwise, triangles has two sides…
It looks more like a zfighting problem mixed with blending.
Disable depth test, to see if it gets uniformly dark.
To sort that out properly, you can use the stencil buffer when drawing your grey triangles.
Increment stencil on draw, and set the stencil test to =0 or something like that. So that each pixel of the screen will only be drawn once.
// test passes only if stencil is equal to 0 :
gl.glStencilFunc( GL.GL_EQUAL, 0, 0xFFFFFFFF);
// increment on draw :
gl.glStencilOp( GL.GL_INCR, GL.GL_INCR, GL.GL_INCR );
Post an updated screenshot if you still have troubles.
Edit: and don’t forget to clear stencil between frames : glClear(GL_STENCIL_BUFFER_BIT);