How to pass non interpolated data OpenGL ES (GLSL)

我是研究僧i 提交于 2021-02-19 03:57:07

问题


I'm trying to pass simple FLOAT value from vertex to fragment shader. How can I pass it "as is" without interpolation? On desktop I could use flat varying to disable interpolation, is there something similar in openGL es or the only way is through texture?


回答1:


GLSL ES does currently not support the flat keyword, so the only way is to use the same float value in all the triangle vertices.

The same answer was given here: In opengl es 2, is there a way to prevent interpolation of varyings




回答2:


GLSL ES 2.0 does not support the flat interpolation qualifier, just as it does not support integral vertex shader output variables.
Compare OpenGL ES 2.0 Specification and OpenGL ES 3.0. Specification.



来源:https://stackoverflow.com/questions/11700134/how-to-pass-non-interpolated-data-opengl-es-glsl

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