简体   繁体   中英

blend overlapping triangles in opengl

I'm building a thick line from triangles. The problem i'm having is that when the curve is semi transparent and some triangles overlap i get the effect in the picture. I would like for the triangles alphas to not get added.

I'm using this blend function:

glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_CONSTANT_ALPHA);

我所看到的

You may render the curve to separate render target with full opacity and then draw that target with custom alpha. Otherwise you should avoid overlapping.

您可以使用模板测试来阻止已经绘制的碎片的绘制(这样可以防止从第一个位置混合)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM