渲染不同颜色的选定三角形?

时间:2017-03-03 10:55:39

标签: opengl directx rendering shader mesh

我想知道在网格上以不同颜色渲染选定三角形的最佳方法是什么?我正在使用OpenGL,但具体的渲染系统可能无关紧要。

一种方法是将选定的三角形渲染到现有网格的顶部,但我觉得必须有一种更好的方法来使用着色器吗?

1 个答案:

答案 0 :(得分:1)

我认为最简单的方法是为三角形创建一个单独的颜色缓冲区。您随后可以使用 school .classAttribute .SelectMany(ca=> ca.students) .SelectMany(s=> s.students) .ToList() .ForEach(student => { // Get data from dictionary and update properties student.Weight = "data from dictionary"; student.Height= ""data from dictionary; }); (请参阅here)恢复取消选择的三角形的颜色,并更新那些新选择的那些颜色。

这假设您知道缓冲区中哪个索引要更改颜色的三角形的顶点所在的位置。

也可以让附加缓冲区仅包含布尔值,并用统一变量中指定的值覆盖所选三角形的颜色。