[Bf-blender-cvs] [986018165b4] soc-2017-vertex_paint: now alpha effect can be seen in 3d view in vpaint

Darshan Kadu noreply at git.blender.org
Fri Jul 14 10:40:20 CEST 2017


Commit: 986018165b4b32ee382d16ad3e1af5399d76acb7
Author: Darshan Kadu
Date:   Fri Jul 14 14:09:45 2017 +0530
Branches: soc-2017-vertex_paint
https://developer.blender.org/rB986018165b4b32ee382d16ad3e1af5399d76acb7

now alpha effect can be seen in 3d view in vpaint

===================================================================

M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/gpu/intern/gpu_buffers.c

===================================================================

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 8b769f760f6..ee3a763e4c8 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -751,7 +751,10 @@ static void cdDM_drawMappedFaces(
 	}
 	else if (setDrawOptions == NULL) {
 		/* just draw the entire face array */
+		glEnable(GL_BLEND);
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		GPU_buffer_draw_elements(dm->drawObject->triangles, GL_TRIANGLES, 0, tot_tri_elem);
+		glDisable(GL_BLEND);
 	}
 	else {
 		for (mat_index = 0; mat_index < dm->drawObject->totmaterial; mat_index++) {
@@ -1523,8 +1526,8 @@ static void cdDM_buffer_copy_mcol(
 
 	for (i = 0; i < totpoly; i++, mpoly++) {
 		for (j = 0; j < mpoly->totloop; j++) {
-			copy_v3_v3_uchar(&varray[start], &mloopcol[mpoly->loopstart + j].r);
-			start += 3;
+			copy_v4_v4_uchar(&varray[start], &mloopcol[mpoly->loopstart + j].r);
+			start += 4;
 		}
 	}
 }
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 9f1fe3a5a67..0324d090a21 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -82,7 +82,7 @@ const GPUBufferTypeSettings gpu_buffer_type_settings[] = {
     /* normal */
     {GL_ARRAY_BUFFER, 4}, /* we copy 3 shorts per normal but we add a fourth for alignment */
     /* mcol */
-    {GL_ARRAY_BUFFER, 3},
+    {GL_ARRAY_BUFFER, 4},
     /* uv */
     {GL_ARRAY_BUFFER, 2},
     /* uv for texpaint */
@@ -690,7 +690,7 @@ void GPU_color_setup(DerivedMesh *dm, int colType)
 
 	glEnableClientState(GL_COLOR_ARRAY);
 	glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->colors->id);
-	glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0);
+	glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
 
 	GLStates |= GPU_BUFFER_COLOR_STATE;
 }




More information about the Bf-blender-cvs mailing list