diff options
Diffstat (limited to 'source/blender/editors/space_console')
-rw-r--r-- | source/blender/editors/space_console/console_draw.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_console/space_console.c | 11 |
2 files changed, 21 insertions, 12 deletions
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c index 6ee658b744c..66b203ff612 100644 --- a/source/blender/editors/space_console/console_draw.c +++ b/source/blender/editors/space_console/console_draw.c @@ -40,6 +40,7 @@ #include "MEM_guardedalloc.h" #include "BIF_gl.h" +#include "GPU_immediate.h" #include "UI_interface.h" #include "UI_resources.h" @@ -157,6 +158,8 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha int offl = 0, offc = 0; int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN}; int pen[2]; + Gwn_VertFormat *format = immVertexFormat(); + unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); xy[1] += tvc->lheight / 6; console_cursor_wrap_offset(sc->prompt, tvc->console_width, &offl, &offc, NULL); @@ -168,14 +171,17 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha pen[1] += tvc->lheight * offl; /* cursor */ - UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg); - glColor3ubv(fg); - - glRecti((xy[0] + pen[0]) - 1, - (xy[1] + pen[1]), - (xy[0] + pen[0]) + 1, - (xy[1] + pen[1] + tvc->lheight) - ); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformThemeColor(TH_CONSOLE_CURSOR); + + immRectf(pos, + (xy[0] + pen[0]) - 1, + (xy[1] + pen[1]), + (xy[0] + pen[0]) + 1, + (xy[1] + pen[1] + tvc->lheight) + ); + + immUnbindProgram(); } console_line_color(fg, cl_iter->type); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 3f5adf6c1c5..4b577a7cb7e 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -49,10 +49,11 @@ #include "UI_view2d.h" #include "console_intern.h" // own include +#include "GPU_framebuffer.h" /* ******************** default callbacks for console space ***************** */ -static SpaceLink *console_new(const bContext *UNUSED(C)) +static SpaceLink *console_new(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) { ARegion *ar; SpaceConsole *sconsole; @@ -67,7 +68,7 @@ static SpaceLink *console_new(const bContext *UNUSED(C)) BLI_addtail(&sconsole->regionbase, ar); ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = RGN_ALIGN_BOTTOM; + ar->alignment = RGN_ALIGN_TOP; /* main region */ @@ -227,7 +228,7 @@ static void console_main_region_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + GPU_clear(GPU_COLOR_BIT); /* worlks best with no view2d matrix set */ UI_view2d_view_ortho(v2d); @@ -368,7 +369,9 @@ static void console_header_region_draw(const bContext *C, ARegion *ar) ED_region_header(C, ar); } -static void console_main_region_listener(bScreen *UNUSED(sc), ScrArea *sa, ARegion *ar, wmNotifier *wmn) +static void console_main_region_listener( + bScreen *UNUSED(sc), ScrArea *sa, ARegion *ar, + wmNotifier *wmn, const Scene *UNUSED(scene)) { // SpaceInfo *sinfo = sa->spacedata.first; |