简体   繁体   中英

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?

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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