The fact that it doesn't work with flat shading is not a bug, the vertex normals add another attribute and you're probably not getting the right attribute id anymore in that case.
The way this should be implemented is not through gl_Color, but the same as as other data layers passed to GLSL shaders. They call GPU_attribute(..) to pass same data layer as an attribute to the GLSL shader. This will then cause GPUVertexAttribs to contain the data layer, which is used by DM_vertex_attributes_from_gpu to find the corresponding data layers in the mesh for drawing. The mask is stored as a data layer CD_PAINT_MASK, so as far as I can tell it should be possible to get this working. On Fri, May 24, 2013 at 4:09 AM, Erik Sejersen <ehsejer...@gmail.com> wrote: > Hi, > > I've found a way to get the mask information into the shader without using > any gl calls. By adding gl_FrontColor = gl_Color to the vertex shader I can > use gl_Color in the fragment shader. > The only problem I have atm is that when I use flat shading mode the value > og gl_Color in the fragment shader suddenly holds the value of "varnormal". > I guess it's a driver bug of sorts as it doesn't happen in smooth shading. > > Also the code I've added enables regular GLSL also as a side bonus. > > -Erik > _______________________________________________ > Bf-committers mailing list > Bf-committers@blender.org > http://lists.blender.org/mailman/listinfo/bf-committers _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers