[Bf-blender-cvs] [2b726b0] blender2.8: blender 2.8: OpenGL immediate mode: node_draw_preview_background

Mike Erwin noreply at git.blender.org
Tue Nov 8 17:12:32 CET 2016


Commit: 2b726b054e3385708b031bebb50c59f7cbb7c149
Author: Mike Erwin
Date:   Tue Nov 8 11:10:47 2016 -0500
Branches: blender2.8
https://developer.blender.org/rB2b726b054e3385708b031bebb50c59f7cbb7c149

blender 2.8: OpenGL immediate mode: node_draw_preview_background

all is in the title.

Reviewers: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2336

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

M	source/blender/editors/space_node/node_draw.c

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

diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index c532846..6b33497 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -638,10 +638,15 @@ static void node_draw_preview_background(float tile, rctf *rect)
 {
 	float x, y;
 	
+	VertexFormat *format = immVertexFormat();
+	unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+
+	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+
 	/* draw checkerboard backdrop to show alpha */
-	glColor3ub(120, 120, 120);
-	glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
-	glColor3ub(160, 160, 160);
+	immUniformColor3ub(120, 120, 120);
+	immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
+	immUniformColor3ub(160, 160, 160);
 	
 	for (y = rect->ymin; y < rect->ymax; y += tile * 2) {
 		for (x = rect->xmin; x < rect->xmax; x += tile * 2) {
@@ -652,7 +657,7 @@ static void node_draw_preview_background(float tile, rctf *rect)
 			if (y + tile > rect->ymax)
 				tiley = rect->ymax - y;
 
-			glRectf(x, y, x + tilex, y + tiley);
+			immRectf(pos, x, y, x + tilex, y + tiley);
 		}
 	}
 	for (y = rect->ymin + tile; y < rect->ymax; y += tile * 2) {
@@ -664,9 +669,10 @@ static void node_draw_preview_background(float tile, rctf *rect)
 			if (y + tile > rect->ymax)
 				tiley = rect->ymax - y;
 
-			glRectf(x, y, x + tilex, y + tiley);
+			immRectf(pos, x, y, x + tilex, y + tiley);
 		}
 	}
+	immUnbindProgram();
 }
 
 /* not a callback */




More information about the Bf-blender-cvs mailing list