简体   繁体   English

在OpenGL中使用顶点颜色和纹理?

[英]Using vertex colors and textures in OpenGL?

I am familiar with texture usage in OpenGL. 我熟悉OpenGL中的纹理用法。 I am also familiar with the coloring and interpolation of colors between vertices. 我也熟悉顶点之间的颜色着色和插值。 Can the two be used in conjunction with one another? 两者可以结合使用吗? Does doing so tint the texture with the color supplied at each vertex? 这样做是否使纹理具有每个顶点提供的颜色? I am rendering an older game format which supplies both so I am trying to figure out if they both work in conjunction to create variations for the textures. 我正在渲染同时提供这两种格式的较旧游戏格式,因此我试图弄清楚它们是否可以协同工作以创建纹理的变体。

Cheers. 干杯。

Yes you can do that. 是的,你可以这么做。 If you set the colour on a vertex to anything other than white, the texture that is applied will be filtered by the colour given. 如果将顶点上的颜色设置为白色以外的任何其他颜色,则所应用的纹理将通过给定的颜色进行过滤。 If different vertices on the same polygon have different colours, and there are textures, the colours will be interpolated exactly the same as for no textures. 如果同一多边形上的不同顶点具有不同的颜色,并且存在纹理,则将插值颜色的插值与没有纹理时的颜色完全相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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