Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

opengl-es

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?

like image 863
RobbieC Avatar asked Oct 15 '22 02:10

RobbieC


1 Answers

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.

like image 69
Dr. Snoopy Avatar answered Oct 18 '22 08:10

Dr. Snoopy