在opengl es 2中,有没有办法防止变化的插值 [英] In opengl es 2, is there a way to prevent interpolation of varyings

查看:42
本文介绍了在opengl es 2中,有没有办法防止变化的插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

换句话说,模拟旧的 opengl 平面着色模型,例如,您可以有一个线条带,其中每个段都是不同的颜色,而不是跨段的颜色插值?

In other words, emulating the old opengl flat shading model, so you could for example have a line strip where each segment is a distinct color rather than an interpolation of color across the segment?

推荐答案

不是直接的.GLSL for Desktop 有 flat 关键字,但 GLSL ES 没有(它是保留的).模拟这种行为的一个技巧是在三角形(或线段)中的每个顶点分配相同的颜色,因此插值在相同的值之间.

Not directly. GLSL for Desktop has the flat keyword, but GLSL ES doesn't have it (it's reserved). A trick to emulate this behaviour is to assign the same color at each vertex in a triangle (or in a segment), so the interpolation is between the same value.

这篇关于在opengl es 2中,有没有办法防止变化的插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆