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
This commit is contained in:
Mike Erwin
2016-11-08 10:04:41 -05:00
parent 66d7f01ecc
commit 4e80bd2d6d

View File

@@ -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 */