Fix wrong vertex colors in edit mode
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Jun 2016 09:52:31 +0000 (11:52 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 1 Jun 2016 09:53:28 +0000 (11:53 +0200)
source/blender/blenkernel/intern/editderivedmesh.c

index 0de4d1b4dd52c2bb2f0793ec01c3709ed50be991..fbb5069425cb9311a55fe18672bc75a33735061d 100644 (file)
@@ -1452,15 +1452,15 @@ static void emdm_pass_attrib_vertex_glsl(const DMVertexAttribs *attribs, const B
                glUniform1i(attribs->tface[i].gl_info_index, 0);
        }
        for (i = 0; i < attribs->totmcol; i++) {
-               GLubyte col[4];
+               float col[4];
                if (attribs->mcol[i].em_offset != -1) {
                        const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset);
-                       copy_v4_v4_uchar(col, &cp->r);
+                       rgba_uchar_to_float(col, &cp->r);
                }
                else {
-                       col[0] = 0; col[1] = 0; col[2] = 0; col[3] = 0;
+                       col[0] = 0.0f; col[1] = 0.0f; col[2] = 0.0f; col[3] = 0.0f;
                }
-               glVertexAttrib4ubv(attribs->mcol[i].gl_index, col);
+               glVertexAttrib4fv(attribs->mcol[i].gl_index, col);
                glUniform1i(attribs->mcol[i].gl_info_index, GPU_ATTR_INFO_SRGB);
        }