I've tried printing out the shader when it's compiled and there doesn't seem to be any difference.
It does seem like a bug because the gl_Color in the fragment shader depends on what varnormal is assigned in the vertex shader. I've tried setting varnomal to different colors and doing result = gl_Color and gl_Color always containts what varnormal was assigned. Anywho I've removed gl_Color and started using the attribute system. Smooth shading isn't working for multires because of the use of indexed buffers. Multires should still have the option to flat shade so a option would be to add another checkbox for 'Fast Drawing' where smooth shading is forced if multires is used. Another would be to modify the drawing code to not use indexed buffers but that is a rather large undertaking or am I overestimating the task? Unfortunately OpenGL does not have flat shading support with index buffers in GLSL before OpenGL 3.1 where the flat keyword was introduced. There are still some minor issues to address but it looks like it almost ready. -Erik 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 _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers