[Bf-blender-cvs] [4e80bd2] blender2.8: Blender 2.8: OpenGL: new immediate mode API for screendump.c

Mike Erwin noreply at git.blender.org
Tue Nov 8 16:10:58 CET 2016


Commit: 4e80bd2d6d2f54db3b65d9f65341ac9c99ee8751
Author: Mike Erwin
Date:   Tue Nov 8 10:04:41 2016 -0500
Branches: blender2.8
https://developer.blender.org/rB4e80bd2d6d2f54db3b65d9f65341ac9c99ee8751

Blender 2.8: OpenGL: new immediate mode API for screendump.c

It's the screencast cursor, tested here, compared to original, seems to be working fine.

Reviewers: dfelinto, Severin, merwin

Reviewed By: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

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

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

M	source/blender/editors/screen/screendump.c

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

diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 2dd7400..6bfa51b 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -56,6 +56,8 @@
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
+#include "GPU_immediate.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
 
@@ -451,25 +453,24 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 /* Helper callback for drawing the cursor itself */
 static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUSED(p_ptr))
 {
-	
-	glPushMatrix();
-	
-	glTranslatef((float)x, (float)y, 0.0f);
-	
-	
 	glEnable(GL_LINE_SMOOTH);
 	glEnable(GL_BLEND);
-	
-	glColor4ub(0, 0, 0, 32);
-	glutil_draw_filled_arc(0.0, M_PI * 2.0, 20, 40);
-	
-	glColor4ub(255, 255, 255, 128);
-	glutil_draw_lined_arc(0.0, M_PI * 2.0, 20, 40);
+
+	VertexFormat* format = immVertexFormat();
+	unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+
+	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+
+	immUniformColor4ub(0, 0, 0, 32);
+	imm_draw_filled_circle(pos, (float)x, (float)y, 20, 40);
+
+	immUniformColor4ub(255, 255, 255, 128);
+	imm_draw_lined_circle(pos, (float)x, (float)y, 20, 40);
+
+	immUnbindProgram();
 	
 	glDisable(GL_BLEND);
 	glDisable(GL_LINE_SMOOTH);
-	
-	glPopMatrix();
 }
 
 /* Turn brush cursor in 3D view on/off */




More information about the Bf-blender-cvs mailing list