I have a question about sharing information between vertices on a same triangle when writing GLES 2 shaders.
before, when we use Opengl, sharing an information between vertices on a same triangle is very easy.
for example, if we want the normal of the three vertices of the triangle be the same, we can simply do this:
the three points will have the same normal inside the shader program.
but as for GLES2 (and i guess the new opengl standard), we are forced to use vertex attributes.
so how do i share an information between points on the same triangle.
the normal case is one example. another example is the texture coordinate case.
for example, if i want to texture map a ball. there must be some points that are on the seam of the texture. in other words, those points must have two sets of texture coordinates or even more.
depending on which triangle you are drawing, you assign difference texture coordinates to the point.
but with gles 2 shader, i don't know how to do this, because it seems that a vertex always maps to a single texture coordinate:
attribute vec4 vertex;
attribute vec4 texcoord;
of course, duplicating points is a solution, but in the facet normal case, you need to duplicate a lot of points in order to use different normals on different facet.
i would like to give another example:
suppose we have a geometry object formed by triangles.
now, i need to write a gles 2 shader that color different triangle with different color.
how do i do that?