Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/screen/area.c
| Context not available. | |||||
| BLI_rcti_init(&click_rect, x, x + icon_size, y, y + icon_size); | BLI_rcti_init(&click_rect, x, x + icon_size, y, y + icon_size); | ||||
| glColor4ub(255, 0, 0, alpha_debug); | VertexFormat* format = immVertexFormat(); | ||||
| fdrawbox(click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax); | unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| glColor4ub(0, 255, 255, alpha_debug); | |||||
| fdrawline(click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
merwin: The immUniformColor calls only work with UNIFORM_COLOR shaders. Use different shader here. | |||||
| fdrawline(click_rect.xmin, click_rect.ymax, click_rect.xmax, click_rect.ymin); | |||||
| immUniformColor4ub(255, 0, 0, alpha_debug); | |||||
| imm_draw_line_box(pos, click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax); | |||||
| immUniformColor4ub(0, 255, 255, alpha_debug); | |||||
| imm_draw_line_box(pos, click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax); | |||||
krashUnsubmitted Done Inline ActionsI'm not sure I understand why you replace fdrawline with imm_draw_line_box? krash: I'm not sure I understand why you replace fdrawline with imm_draw_line_box? | |||||
merwinUnsubmitted Done Inline ActionsGood catch @Anthony Edlin (krash). There is no replacement function for fdrawline, so expand these into Begin(LINES, 4) Vertex Vertex Vertex Vertex End merwin: Good catch @krash.
There is no replacement function for fdrawline, so expand these into
```… | |||||
| imm_draw_line_box(pos, click_rect.xmin, click_rect.ymax, click_rect.xmax, click_rect.ymin); | |||||
| immUnbindProgram(); | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| float width = 0.1f * U.widget_unit; | float width = 0.1f * U.widget_unit; | ||||
| float pad = 0.2f * U.widget_unit; | float pad = 0.2f * U.widget_unit; | ||||
| glRectf((x1 + x2 - width) * 0.5f, y1 + pad, (x1 + x2 + width) * 0.5f, y2 - pad); | VertexFormat* format = immVertexFormat(); | ||||
| glRectf(x1 + pad, (y1 + y2 - width) * 0.5f, (x1 + x2 - width) * 0.5f, (y1 + y2 + width) * 0.5f); | unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| glRectf((x1 + x2 + width) * 0.5f, (y1 + y2 - width) * 0.5f, x2 - pad, (y1 + y2 + width) * 0.5f); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immRectf(pos, (x1 + x2 - width) * 0.5f, y1 + pad, (x1 + x2 + width) * 0.5f, y2 - pad); | |||||
| immRectf(pos, x1 + pad, (y1 + y2 - width) * 0.5f, (x1 + x2 - width) * 0.5f, (y1 + y2 + width) * 0.5f); | |||||
| immRectf(pos, (x1 + x2 + width) * 0.5f, (y1 + y2 - width) * 0.5f, x2 - pad, (y1 + y2 + width) * 0.5f); | |||||
| immUnbindProgram(); | |||||
| } | } | ||||
| static void region_draw_azone_tab_plus(AZone *az) | static void region_draw_azone_tab_plus(AZone *az) | ||||
| Context not available. | |||||
| /* for debugging unneeded area redraws and partial redraw */ | /* for debugging unneeded area redraws and partial redraw */ | ||||
| #if 0 | #if 0 | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| glColor4f(drand48(), drand48(), drand48(), 0.1f); | VertexFormat* format = immVertexFormat(); | ||||
| glRectf(ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin, | unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
Done Inline ActionsUse UNIFORM_COLOR shader here. merwin: Use UNIFORM_COLOR shader here. | |||||
| immUniformColor4f(drand48(), drand48(), drand48(), 0.1f); | |||||
| immRectf(pos, ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin, | |||||
| ar->drawrct.xmax - ar->winrct.xmin, ar->drawrct.ymax - ar->winrct.ymin); | ar->drawrct.xmax - ar->winrct.xmin, ar->drawrct.ymax - ar->winrct.ymin); | ||||
| immUnbindProgram(); | |||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| #endif | #endif | ||||
| Context not available. | |||||
| /* view should be in pixelspace */ | /* view should be in pixelspace */ | ||||
| UI_view2d_view_restore(C); | UI_view2d_view_restore(C); | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| UI_ThemeColor4((ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK); | VertexFormat* format = immVertexFormat(); | ||||
| glRecti(0, 0, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct) + 1); | unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformThemeColor((ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK); | |||||
| immRecti(pos, 0, 0, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct) + 1); | |||||
| immUnbindProgram(); | |||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| else { | else { | ||||
| Context not available. | |||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||||
| glColor4fv(fill_color); | VertexFormat* format = immVertexFormat(); | ||||
| glRecti(rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1); | unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformColor4fv(fill_color); | |||||
| immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1); | |||||
| immUnbindProgram(); | |||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| /* text */ | /* text */ | ||||
| Context not available. | |||||
| box_y = metadata_box_height_get(ibuf, blf_mono_font, true); | box_y = metadata_box_height_get(ibuf, blf_mono_font, true); | ||||
| if (box_y) { | if (box_y) { | ||||
| UI_ThemeColor(TH_METADATA_BG); | |||||
| /* set up rect */ | /* set up rect */ | ||||
| BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); | BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymax, frame->ymax + box_y); | ||||
| /* draw top box */ | /* draw top box */ | ||||
| glRectf(rect.xmin, rect.ymin, rect.xmax, rect.ymax); | VertexFormat* format = immVertexFormat(); | ||||
| unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformThemeColor(TH_METADATA_BG); | |||||
| immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | |||||
| immUnbindProgram(); | |||||
| BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | ||||
| BLF_enable(blf_mono_font, BLF_CLIPPING); | BLF_enable(blf_mono_font, BLF_CLIPPING); | ||||
| Context not available. | |||||
| box_y = metadata_box_height_get(ibuf, blf_mono_font, false); | box_y = metadata_box_height_get(ibuf, blf_mono_font, false); | ||||
| if (box_y) { | if (box_y) { | ||||
| UI_ThemeColor(TH_METADATA_BG); | |||||
| /* set up box rect */ | /* set up box rect */ | ||||
| BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); | BLI_rctf_init(&rect, frame->xmin, frame->xmax, frame->ymin - box_y, frame->ymin); | ||||
| /* draw top box */ | /* draw top box */ | ||||
| glRectf(rect.xmin, rect.ymin, rect.xmax, rect.ymax); | VertexFormat* format = immVertexFormat(); | ||||
| unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformThemeColor(TH_METADATA_BG); | |||||
| immRectf(pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | |||||
| immUnbindProgram(); | |||||
| BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | BLF_clipping(blf_mono_font, rect.xmin, rect.ymin, rect.xmax, rect.ymax); | ||||
| BLF_enable(blf_mono_font, BLF_CLIPPING); | BLF_enable(blf_mono_font, BLF_CLIPPING); | ||||
| Context not available. | |||||
| void ED_region_cache_draw_background(const ARegion *ar) | void ED_region_cache_draw_background(const ARegion *ar) | ||||
| { | { | ||||
| glColor4ub(128, 128, 255, 64); | VertexFormat* format = immVertexFormat(); | ||||
| glRecti(0, 0, ar->winx, 8 * UI_DPI_FAC); | unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformColor4ub(128, 128, 255, 64); | |||||
| immRecti(pos, 0, 0, ar->winx, 8 * UI_DPI_FAC); | |||||
| immUnbindProgram(); | |||||
| } | } | ||||
| void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y) | void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y) | ||||
| Context not available. | |||||
The immUniformColor calls only work with UNIFORM_COLOR shaders. Use different shader here.