In opengl es 2, is there a way to prevent interpolation of varyings

半腔热情 提交于 2019-12-07 10:40:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/3409516/in-opengl-es-2-is-there-a-way-to-prevent-interpolation-of-varyings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!