Search code examples
iosopengl-esglslopengl-es-2.0

How to pass non interpolated data OpenGL ES (GLSL)


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?


Solution

  • 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