diff options
author | Mike Erwin <significant.bit@gmail.com> | 2017-04-07 23:31:26 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2017-04-07 23:31:26 +0300 |
commit | bd3a1b9490d96ca00748f405037379b743744877 (patch) | |
tree | aed8ff42fb92cc78de6729cd6d90c3c5ee9ad8ca /source/blender | |
parent | c1dc078840541bd64f95fdeca52267c75a061e04 (diff) |
OpenGL: use PRIM instead of GL enum for immBegin
Getting ready for a Gawain API change...
Part of T49043
Diffstat (limited to 'source/blender')
51 files changed, 346 insertions, 347 deletions
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index b5f4a13587d..5fc7fe1d8f4 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -240,7 +240,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** if (gridline_ct == 0) goto drawgrid_cleanup; /* nothing to draw */ - immBegin(GL_LINES, gridline_ct * 2); + immBegin(PRIM_LINES, gridline_ct * 2); } float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar); @@ -293,7 +293,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** if (gridline_ct == 0) goto drawgrid_cleanup; /* nothing to draw */ - immBegin(GL_LINES, gridline_ct * 2); + immBegin(PRIM_LINES, gridline_ct * 2); if (grids_to_draw == 2) { UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2); @@ -373,7 +373,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(GL_LINES, vertex_ct); + immBegin(PRIM_LINES, vertex_ct); /* draw normal grid lines */ UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10); @@ -460,7 +460,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit) unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(GL_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); + immBegin(PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); if (show_axis_x) { UI_make_axis_color(col_grid, col_axis, 'X'); @@ -658,7 +658,7 @@ void DRW_draw_cursor(void) const int segments = 16; - immBegin(GL_LINE_LOOP, segments); + immBegin(PRIM_LINE_LOOP, segments); immAttrib3fv(wpos, co); for (int i = 0; i < segments; ++i) { @@ -677,7 +677,7 @@ void DRW_draw_cursor(void) UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immAttrib3ubv(color, crosshair_color); immAttrib3fv(wpos, co); diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 17bca28cba7..0ebd556a0f5 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3927,7 +3927,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float glLineWidth(2.0f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, (float)offset, yminc); immVertex2f(pos, (float)v2d->cur.xmax, yminc); immEnd(); diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 398bb225fbf..a2ad5c582d5 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -136,7 +136,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) /* Draw a light green line to indicate current frame */ immUniformThemeColor(TH_CFRAME); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */ immVertex2f(pos, x, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 6f61ce3cf25..e78752a557c 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -361,7 +361,7 @@ static void draw_marker( immUniformColor4ub(0, 0, 0, 96); } - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, xpos + 0.5f, 12.0f); immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale); immEnd(); diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 60e2440bcc5..7212496a2cc 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -521,7 +521,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS glEnable(GL_LINE_SMOOTH); imm_cpack(0x0); - immBegin(GL_LINE_STRIP, stroke_len); + immBegin(PRIM_LINE_STRIP, stroke_len); glLineWidth(3.0f); if (v3d->zbuf) { @@ -535,7 +535,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS immEnd(); imm_cpack(0xffffffff); - immBegin(GL_LINE_STRIP, stroke_len); + immBegin(PRIM_LINE_STRIP, stroke_len); glLineWidth(1.0f); for (int i = 0; i < stroke_len; i++) { diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 7e33de7b271..70d97b28202 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -156,7 +156,7 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* Draw all triangles for filling the polygon */ - immBegin(GL_TRIANGLES, tot_triangles * 3); + immBegin(PRIM_TRIANGLES, tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ const tGPspoint *pt; @@ -217,7 +217,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short /* if drawing a single point, draw it larger */ glPointSize((float)(thickness + 2) * points->pressure); immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); gp_set_tpoint_varying_color(pt, ink, color); immVertex2iv(pos, &pt->x); } @@ -229,7 +229,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short glLineWidth(max_ff(oldpressure * thickness, 1.0)); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBeginAtMost(GL_LINE_STRIP, totpoints); + immBeginAtMost(PRIM_LINE_STRIP, totpoints); /* TODO: implement this with a geometry shader to draw one continuous tapered stroke */ @@ -248,7 +248,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short draw_points = 0; glLineWidth(max_ff(pt->pressure * thickness, 1.0f)); - immBeginAtMost(GL_LINE_STRIP, totpoints - i + 1); + immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -329,7 +329,7 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(GL_POINTS, totpoints); + immBegin(PRIM_POINTS, totpoints); const tGPspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -356,7 +356,7 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(GL_POINTS, totpoints); + immBegin(PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { @@ -389,7 +389,7 @@ static void gp_draw_stroke_volumetric_3d( immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); GPU_enable_program_point_size(); - immBegin(GL_POINTS, totpoints); + immBegin(PRIM_POINTS, totpoints); const bGPDspoint *pt = points; for (int i = 0; i < totpoints && pt; i++, pt++) { @@ -536,7 +536,7 @@ static void gp_draw_stroke_fill( immUniformColor4fv(color); /* Draw all triangles for filling the polygon (cache must be calculated before) */ - immBegin(GL_TRIANGLES, gps->tot_triangles * 3); + immBegin(PRIM_TRIANGLES, gps->tot_triangles * 3); /* TODO: use batch instead of immediate mode, to share vertices */ bGPDtriangle *stroke_triangle = gps->triangles; @@ -614,7 +614,7 @@ static void gp_draw_stroke_point( /* set point thickness (since there's only one of these) */ immUniform1f("size", (float)(thickness + 2) * pt->pressure); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, fpt); immEnd(); @@ -647,7 +647,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi /* draw stroke curve */ glLineWidth(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(GL_LINE_STRIP, totpoints + cyclic_add); + immBeginAtMost(PRIM_LINE_STRIP, totpoints + cyclic_add); const bGPDspoint *pt = points; for (int i = 0; i < totpoints; i++, pt++) { gp_set_point_varying_color(pt, ink, color); @@ -668,7 +668,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi curpressure = pt->pressure; glLineWidth(max_ff(curpressure * thickness, 1.0f)); - immBeginAtMost(GL_LINE_STRIP, totpoints - i + 1 + cyclic_add); + immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add); /* need to roll-back one point to ensure that there are no gaps in the stroke */ if (i != 0) { @@ -1185,7 +1185,7 @@ static void gp_draw_strokes_edit( immBindBuiltinProgram(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR); } - immBegin(GL_POINTS, gps->totpoints); + immBegin(PRIM_POINTS, gps->totpoints); /* Draw start and end point differently if enabled stroke direction hint */ bool show_direction_hint = (gpd->flag & GP_DATA_SHOW_DIRECTION) && (gps->totpoints > 1); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 3162584e910..bf14ed9df94 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -645,7 +645,7 @@ static void histogram_draw_one( /* curve outline */ glLineWidth(1.5); - immBegin(GL_LINE_STRIP, res); + immBegin(PRIM_LINE_STRIP, res); for (int i = 0; i < res; i++) { float x2 = x + i * (w / (float)res); immVertex2f(pos_attrib, x2, y + (data[i] * h)); @@ -654,7 +654,7 @@ static void histogram_draw_one( } else { /* under the curve */ - immBegin(GL_TRIANGLE_STRIP, res * 2); + immBegin(PRIM_TRIANGLE_STRIP, res * 2); immVertex2f(pos_attrib, x, y); immVertex2f(pos_attrib, x, y + (data[0] * h)); for (int i = 1; i < res; i++) { @@ -668,7 +668,7 @@ static void histogram_draw_one( immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - immBegin(GL_LINE_STRIP, res); + immBegin(PRIM_LINE_STRIP, res); for (int i = 0; i < res; i++) { float x2 = x + i * (w / (float)res); immVertex2f(pos_attrib, x2, y + (data[i] * h)); @@ -728,7 +728,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, rect.xmin, rect.ymin + fac * h); immVertex2f(pos, rect.xmax, rect.ymin + fac * h); @@ -853,7 +853,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f); /* draw grid lines here */ - immBegin(GL_LINES, 12); + immBegin(PRIM_LINES, 12); for (int i = 0; i < 6; i++) { immVertex2f(pos, rect.xmin + 22, yofs + (i * 0.2f) * h); @@ -864,7 +864,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* 3 vertical separation */ if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) { - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); for (int i = 1; i < 3; i++) { immVertex2f(pos, rect.xmin + i * w3, rect.ymin); @@ -875,7 +875,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), } /* separate min max zone on the right */ - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, rect.xmin + w, rect.ymin); immVertex2f(pos, rect.xmin + w, rect.ymax); immEnd(); @@ -883,7 +883,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* 16-235-240 level in case of ITU-R BT601/709 */ immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f); if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) { - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(pos, rect.xmin + 22, yofs + h * 16.0f / 255.0f); immVertex2f(pos, rect.xmax + 1, yofs + h * 16.0f / 255.0f); @@ -901,7 +901,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), } /* 7.5 IRE black point level for NTSC */ if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) { - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, rect.xmin, yofs + h * 0.075f); immVertex2f(pos, rect.xmax + 1, yofs + h * 0.075f); immEnd(); @@ -930,7 +930,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), CLAMP(min, rect.ymin, rect.ymax); CLAMP(max, rect.ymin, rect.ymax); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, rect.xmax - 3, min); immVertex2f(pos, rect.xmax - 3, max); immEnd(); @@ -984,7 +984,7 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), CLAMP(min, rect.ymin, rect.ymax); CLAMP(max, rect.ymin, rect.ymax); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, rect.xmin + w + 2 + c * 2, min); immVertex2f(pos, rect.xmin + w + 2 + c * 2, max); immEnd(); @@ -1028,7 +1028,7 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f); dangle = DEG2RADF(2.5f); dampli = 2.5f / 200.0f; - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle)); @@ -1040,22 +1040,22 @@ static void vectorscope_draw_target(unsigned int pos, float centerx, float cente dampli = 0.2f * tampli; dangle2 = DEG2RADF(5.0f); dampli2 = 0.5f * dampli; - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2)); immEnd(); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2)); immEnd(); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2)); immEnd(); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle)); immVertex2f(pos, polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2)); @@ -1110,7 +1110,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f); /* draw grid elements */ /* cross */ - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, centerx - (diam * 0.5f) - 5, centery); immVertex2f(pos, centerx + (diam * 0.5f) + 5, centery); @@ -1123,7 +1123,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco /* circles */ for (int j = 0; j < 5; j++) { const int increment = 15; - immBegin(GL_LINE_LOOP, (int)(360 / increment)); + immBegin(PRIM_LINE_LOOP, (int)(360 / increment)); for (int i = 0; i <= 360 - increment; i += increment) { const float a = DEG2RADF((float)i); const float r = (j + 1) * 0.1f; @@ -1134,7 +1134,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco /* skin tone line */ immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery, diam, 0.5f, skin_rad)); immVertex2f(pos, polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery, diam, 0.1f, skin_rad)); immEnd(); @@ -1171,7 +1171,7 @@ static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, floa { glEnable(GL_LINE_SMOOTH); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, x1 + halfwidth, y1); immVertex2f(pos, x1, y1 + height); immVertex2f(pos, x1 - halfwidth, y1); @@ -1184,7 +1184,7 @@ static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, f { glEnable(fill ? GL_POLYGON_SMOOTH : GL_LINE_SMOOTH); - immBegin(fill ? GL_TRIANGLES : GL_LINE_LOOP, 3); + immBegin(fill ? PRIM_TRIANGLES : PRIM_LINE_LOOP, 3); immVertex2f(pos, x1 + halfwidth, y1); immVertex2f(pos, x1, y1 + height); immVertex2f(pos, x1 - halfwidth, y1); @@ -1224,14 +1224,14 @@ static void ui_draw_colorband_handle( if (active || half_width < min_width) { immUniformColor3ub(0, 0, 0); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, x, y1); immVertex2f(pos, x, y2); immEnd(); setlinestyle(active ? 2 : 1); immUniformColor3ub(200, 200, 200); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, x, y1); immVertex2f(pos, x, y2); immEnd(); @@ -1327,7 +1327,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[1] = y1 + sizey_solid; v2[1] = rect->ymax; - immBegin(GL_TRIANGLE_STRIP, (sizex + 1) * 2); + immBegin(PRIM_TRIANGLE_STRIP, (sizex + 1) * 2); for (int a = 0; a <= sizex; a++) { float pos = ((float)a) / sizex; do_colorband(coba, pos, colf); @@ -1346,7 +1346,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti v1[1] = y1; v2[1] = y1 + sizey_solid; - immBegin(GL_TRIANGLE_STRIP, (sizex + 1) * 2); + immBegin(PRIM_TRIANGLE_STRIP, (sizex + 1) * 2); for (int a = 0; a <= sizex; a++) { float pos = ((float)a) / sizex; do_colorband(coba, pos, colf); @@ -1378,14 +1378,14 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti glEnable(GL_BLEND); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(position, x1, y1); immVertex2f(position, x1 + sizex, y1); immEnd(); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(position, x1, y1 - 1); immVertex2f(position, x1 + sizex, y1 - 1); immEnd(); @@ -1478,7 +1478,7 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo float line_count = floorf((rect->xmax - fx) / dx) + 1.0f + floorf((rect->ymax - fy) / dy) + 1.0f; - immBegin(GL_LINES, (int)line_count * 2); + immBegin(PRIM_LINES, (int)line_count * 2); while (fx < rect->xmax) { immVertex2f(pos, fx, rect->ymin); immVertex2f(pos, fx, rect->ymax); @@ -1587,7 +1587,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f); /* axes */ gl_shaded_color((unsigned char *)wcol->inner, -50); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy)); immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy)); immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymin); @@ -1600,7 +1600,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti #if 0 if (cumap->flag & CUMA_DRAW_CFRA) { immUniformColor3ub(0x60, 0xc0, 0x40); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymin); immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymax); immEnd(); @@ -1609,7 +1609,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti /* sample option */ if (cumap->flag & CUMA_DRAW_SAMPLE) { - immBegin(GL_LINES, 2); /* will draw one of the following 3 lines */ + immBegin(PRIM_LINES, 2); /* will draw one of the following 3 lines */ if (but->a1 == UI_GRAD_H) { float tsample[3]; float hsv[3]; @@ -1645,7 +1645,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti immUniformColor3ubv((unsigned char *)wcol->item); glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - immBegin(GL_LINE_STRIP, (CM_TABLE+1) + 2); + immBegin(PRIM_LINE_STRIP, (CM_TABLE+1) + 2); if (cuma->table == NULL) curvemapping_changed(cumap, false); @@ -1688,7 +1688,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti cmp = cuma->curve; glPointSize(3.0f); - immBegin(GL_POINTS, cuma->totpoint); + immBegin(PRIM_POINTS, cuma->totpoint); for (int a = 0; a < cuma->totpoint; a++) { float color[4]; if (cmp[a].flag & CUMA_SELECT) @@ -1807,7 +1807,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc UI_GetThemeColor4fv(TH_MARKER_OUTLINE, col_outline); /* Do stipple cross with geometry */ - immBegin(GL_LINES, 7*2*2); + immBegin(PRIM_LINES, 7*2*2); float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f}; for (int axe = 0; axe < 2; ++axe) { for (int i = 0; i < 7; ++i) { @@ -1893,7 +1893,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol immUniformColor4ubv(but->col); glEnable(GL_BLEND); - immBegin(GL_TRIANGLE_FAN, 16); + immBegin(PRIM_TRIANGLE_FAN, 16); for (int a = 0; a < 16; a++) immVertex2f(pos, x + size * si[a], y + size * co[a]); immEnd(); @@ -1901,7 +1901,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol immUniformColor4ub(0, 0, 0, 150); glLineWidth(1); glEnable(GL_LINE_SMOOTH); - immBegin(GL_LINE_LOOP, 16); + immBegin(PRIM_LINE_LOOP, 16); for (int a = 0; a < 16; a++) immVertex2f(pos, x + size * si[a], y + size * co[a]); immEnd(); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 9887cf1ee70..12730943f88 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1038,7 +1038,7 @@ static void icon_draw_texture( immUniform1i("image", 0); - immBegin(GL_TRIANGLE_STRIP, 4); + immBegin(PRIM_TRIANGLE_STRIP, 4); immAttrib2f(texCoord, x1, y2); immVertex2f(pos, x, y + h); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 4c17d766b61..d1b4c2cd8fb 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -436,7 +436,7 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float glLineWidth(2.0); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); @@ -477,7 +477,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect) glEnable(GL_BLEND); immUniformColor4ub(255, 255, 255, 50); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, xmin, ymin); immVertex2f(pos, xmax, ymax); @@ -489,7 +489,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect) immUniformColor4ub(0, 0, 0, 50); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, xmin, ymin + 1); immVertex2f(pos, xmax, ymax + 1); @@ -606,7 +606,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con immUniformThemeColor(TH_PANEL_HEADER); immRectf(pos, minx, headrect.ymin + 1, maxx, y); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, minx, y); immVertex2f(pos, maxx, y); @@ -626,14 +626,14 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, minx, y); immVertex2f(pos, maxx, y); immEnd(); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, minx, y - 1); immVertex2f(pos, maxx, y - 1); immEnd(); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index cf6de7adee5..20add65d02f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -201,7 +201,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(draw_color); - immBegin(GL_TRIANGLES, 3 * WIDGET_AA_JITTER); + immBegin(PRIM_TRIANGLES, 3 * WIDGET_AA_JITTER); /* for each AA step */ for (int j = 0; j < WIDGET_AA_JITTER; j++) { @@ -549,7 +549,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, const rcti *rect, float tr static void widget_trias_draw(uiWidgetTrias *tria, unsigned int pos) { - immBegin(GL_TRIANGLES, tria->tot * 3); + immBegin(PRIM_TRIANGLES, tria->tot * 3); for (int i = 0; i < tria->tot; ++i) for (int j = 0; j < 3; ++j) immVertex2fv(pos, tria->vec[tria->index[i][j]]); @@ -2368,7 +2368,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(GL_TRIANGLE_FAN, tot + 2); + immBegin(PRIM_TRIANGLE_FAN, tot + 2); immAttrib3fv(color, colcent); immVertex2f(pos, centx, centy); @@ -2478,7 +2478,7 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons unsigned int col = VertexFormat_add_attrib(format, "color", COMP_F32, 4, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(GL_TRIANGLES, steps * 3 * 6); + immBegin(PRIM_TRIANGLES, steps * 3 * 6); for (dx = 0.0f; dx < 0.999f; dx += color_step) { /* 0.999 = prevent float inaccuracy for steps */ const float dx_next = dx + color_step; @@ -2714,7 +2714,7 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol) immUniformColor4ubv(col); glLineWidth(1.0f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, rect->xmin, y); immVertex2f(pos, rect->xmax, y); immEnd(); @@ -2810,7 +2810,7 @@ void ui_draw_link_bezier(const rcti *rect, const float color[4]) immUniformColor4fv(color); - immBegin(GL_LINE_STRIP, LINK_RESOL + 1); + immBegin(PRIM_LINE_STRIP, LINK_RESOL + 1); for (int i = 0; i <= LINK_RESOL; ++i) immVertex2fv(pos, coord_array[i]); immEnd(); @@ -3166,7 +3166,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(bw, bw, bw, 1.0f); - immBegin(GL_TRIANGLES, 3); + immBegin(PRIM_TRIANGLES, 3); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.9f * height); immVertex2f(pos, rect->xmin + 0.1f * width, rect->ymin + 0.5f * height); immVertex2f(pos, rect->xmin + 0.5f * width, rect->ymin + 0.9f * height); @@ -4094,7 +4094,7 @@ static void draw_disk_shaded( immUniformColor4ubv((unsigned char *)col1); } - immBegin(GL_TRIANGLE_STRIP, subd * 2); + immBegin(PRIM_TRIANGLE_STRIP, subd * 2); for (i = 0; i < subd; i++) { float a; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index a04bd1503d7..a12b033c936 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1330,7 +1330,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GL_LINES, vertex_count); + immBegin(PRIM_LINES, vertex_count); /* vertical lines */ if (flag & V2D_VERTICAL_LINES) { @@ -1475,7 +1475,7 @@ void UI_view2d_constant_grid_draw(View2D *v2d) UI_GetThemeColorShade3fv(TH_BACK, -10, theme_color); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GL_LINES, count_x * 2 + count_y * 2 + 4); + immBegin(PRIM_LINES, count_x * 2 + count_y * 2 + 4); immAttrib3fv(color, theme_color); for (int i = 0; i < count_x ; start_x += step, i++) { @@ -1525,7 +1525,7 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s glLineWidth(1.0f); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBeginAtMost(GL_LINES, vertex_count); + immBeginAtMost(PRIM_LINES, vertex_count); for (int level = 0; level < totlevels; ++level) { UI_GetThemeColorShade3ubv(colorid, offset, grid_line_color); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 84695c209e0..1afa676a0f9 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1008,7 +1008,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) immUniformThemeColor(TH_TRANSFORM); glLineWidth(2.0); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, v1); immVertex3fv(pos, v2); immEnd(); @@ -1055,7 +1055,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.line); glLineWidth(2.0); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, kcd->prev.cage); immVertex3fv(pos, kcd->curr.cage); immEnd(); @@ -1065,7 +1065,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.point); glPointSize(11); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); immEnd(); } @@ -1074,7 +1074,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.curpoint); glPointSize(9); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, kcd->prev.cage); immEnd(); } @@ -1083,7 +1083,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.edge); glLineWidth(2.0); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, kcd->curr.edge->v1->cageco); immVertex3fv(pos, kcd->curr.edge->v2->cageco); immEnd(); @@ -1092,7 +1092,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.point); glPointSize(11); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); immEnd(); } @@ -1101,7 +1101,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.curpoint); glPointSize(9); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, kcd->curr.cage); immEnd(); } @@ -1117,7 +1117,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor4ubv(kcd->colors.point_a); glPointSize(11); - immBeginAtMost(GL_POINTS, kcd->totlinehit); + immBeginAtMost(PRIM_POINTS, kcd->totlinehit); lh = kcd->linehits; for (i = 0; i < kcd->totlinehit; i++, lh++) { @@ -1132,7 +1132,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor4ubv(kcd->colors.curpoint_a); glPointSize(7); - immBeginAtMost(GL_POINTS, kcd->totlinehit); + immBeginAtMost(PRIM_POINTS, kcd->totlinehit); lh = kcd->linehits; for (i = 0; i < kcd->totlinehit; i++, lh++) { @@ -1153,7 +1153,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.line); glLineWidth(1.0); - immBeginAtMost(GL_LINES, BLI_mempool_count(kcd->kedges) * 2); + immBeginAtMost(PRIM_LINES, BLI_mempool_count(kcd->kedges) * 2); BLI_mempool_iternew(kcd->kedges, &iter); for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) { @@ -1174,7 +1174,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ubv(kcd->colors.point); glPointSize(5.0); - immBeginAtMost(GL_POINTS, BLI_mempool_count(kcd->kverts)); + immBeginAtMost(PRIM_POINTS, BLI_mempool_count(kcd->kverts)); BLI_mempool_iternew(kcd->kverts, &iter); for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) { diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 03543ed790b..c6a3e29bad1 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -114,7 +114,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) immUniformColor3ub(255, 0, 255); if (lcd->totedge > 0) { - immBegin(GL_LINES, lcd->totedge * 2); + immBegin(PRIM_LINES, lcd->totedge * 2); for (int i = 0; i < lcd->totedge; i++) { immVertex3fv(pos, lcd->edges[i][0]); @@ -127,7 +127,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) if (lcd->totpoint > 0) { glPointSize(3.0f); - immBegin(GL_POINTS, lcd->totpoint); + immBegin(PRIM_POINTS, lcd->totpoint); for (int i = 0; i < lcd->totpoint; i++) { immVertex3fv(pos, lcd->points[i]); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 78c8619034c..599daef6661 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -97,7 +97,7 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct) unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GL_LINE_STRIP, 5); + immBegin(PRIM_LINE_STRIP, 5); /* right */ immAttrib4ub(color, 0, 0, 0, 30); @@ -231,7 +231,7 @@ static void area_draw_azone_fullscreen(short x1, short y1, short x2, short y2, f imm_draw_line_box(pos, click_rect.xmin, click_rect.ymin, click_rect.xmax, click_rect.ymax); immAttrib4ub(color, 0, 255, 255, alpha_debug); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, click_rect.xmin, click_rect.ymin); immVertex2f(pos, click_rect.xmax, click_rect.ymax); immVertex2f(pos, click_rect.xmin, click_rect.ymax); @@ -260,7 +260,7 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GL_LINES, 12); + immBegin(PRIM_LINES, 12); immAttrib4ub(col, 255, 255, 255, 180); immVertex2f(pos, x1, y2); @@ -307,7 +307,7 @@ static void region_draw_azone_icon(AZone *az) immUniform4f("outlineColor", 0.2f, 0.2f, 0.2f, 0.9f); immUniform1f("outlineWidth", 1.0f); immUniform1f("size", 9.5f); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex2f(pos, midx, midy); immEnd(); immUnbindProgram(); @@ -316,7 +316,7 @@ static void region_draw_azone_icon(AZone *az) /* + */ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniform4f("color", 0.2f, 0.2f, 0.2f, 0.9f); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, midx, midy - 2); immVertex2f(pos, midx, midy + 3); immVertex2f(pos, midx - 2, midy); @@ -2443,7 +2443,7 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy) unsigned color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GL_LINES, 4 * count_fine + 4 * count_large); + immBegin(PRIM_LINES, 4 * count_fine + 4 * count_large); float theme_color[3]; UI_GetThemeColorShade3fv(TH_BACK, (int)(20.0f * (1.0f - blendfac)), theme_color); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index f9e7a27e337..7387d9481d5 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -300,7 +300,7 @@ void immDrawPixelsTexScaled_clipping(float x, float y, int img_w, int img_h, glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, format, GL_UNSIGNED_BYTE, &uc_rect[(((size_t)subpart_y) * offset_y + subpart_h - 1) * img_w * components + (subpart_x * offset_x + subpart_w - 1) * components]); } - immBegin(GL_TRIANGLE_FAN, 4); + immBegin(PRIM_TRIANGLE_FAN, 4); immAttrib2f(texco, (float)(0 + offset_left) / tex_w, (float)(0 + offset_bot) / tex_h); immVertex2f(pos, rast_x + (float)offset_left * xzoom, rast_y + (float)offset_bot * yzoom); @@ -695,28 +695,28 @@ void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, flo delta_y = min_ff(delta_y, border->ymax - border->ymin); /* left bottom corner */ - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmin, border->ymin + delta_y); immVertex2f(pos, border->xmin, border->ymin); immVertex2f(pos, border->xmin + delta_x, border->ymin); immEnd(); /* left top corner */ - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmin, border->ymax - delta_y); immVertex2f(pos, border->xmin, border->ymax); immVertex2f(pos, border->xmin + delta_x, border->ymax); immEnd(); /* right bottom corner */ - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmax - delta_x, border->ymin); immVertex2f(pos, border->xmax, border->ymin); immVertex2f(pos, border->xmax, border->ymin + delta_y); immEnd(); /* right top corner */ - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2f(pos, border->xmax - delta_x, border->ymax); immVertex2f(pos, border->xmax, border->ymax); immVertex2f(pos, border->xmax, border->ymax - delta_y); diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 31acaecf029..4e43a7f96e7 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -94,7 +94,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) } } - immBegin(GL_TRIANGLE_FAN, 5); + immBegin(PRIM_TRIANGLE_FAN, 5); for (i = 0; i < 5; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -102,7 +102,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos) immEnd(); - immBegin(GL_TRIANGLE_FAN, 5); + immBegin(PRIM_TRIANGLE_FAN, 5); for (i = 4; i < 8; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -175,7 +175,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos) } } - immBegin(GL_TRIANGLE_FAN, 5); + immBegin(PRIM_TRIANGLE_FAN, 5); for (i = 0; i < 5; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -183,7 +183,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos) immEnd(); - immBegin(GL_TRIANGLE_FAN, 5); + immBegin(PRIM_TRIANGLE_FAN, 5); for (i = 4; i < 8; i++) { immVertex2f(pos, points[i].x, points[i].y); @@ -246,7 +246,7 @@ static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, shor return; } - immBegin(GL_LINES, count); + immBegin(PRIM_LINES, count); /* right border area */ if (x2 < sizex - 1) { @@ -367,7 +367,7 @@ void ED_screen_draw(wmWindow *win) glEnable(GL_BLEND); immUniformColor4ub(255, 255, 255, 100); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) { immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y); @@ -377,7 +377,7 @@ void ED_screen_draw(wmWindow *win) immUniformColor4ub(0, 0, 0, 100); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, sa3->totrct.xmin, win->eventstate->y + 1); immVertex2f(pos, sa3->totrct.xmax, win->eventstate->y + 1); @@ -390,7 +390,7 @@ void ED_screen_draw(wmWindow *win) immUniformColor4ub(0, 0, 0, 100); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymin); immVertex2f(pos, win->eventstate->x + 1, sa3->totrct.ymax); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 9405de93cc5..744044e89e1 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -888,7 +888,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); glLineWidth(3.0f); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2fv(pos, bez->vec[0]); immVertex2fv(pos, bez->vec[1]); immVertex2fv(pos, bez->vec[2]); @@ -902,7 +902,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez else { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2fv(pos, bez->vec[0]); immVertex2fv(pos, bez->vec[1]); immEnd(); @@ -913,7 +913,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez else { immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f); } - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2fv(pos, bez->vec[1]); immVertex2fv(pos, bez->vec[2]); immEnd(); @@ -961,7 +961,7 @@ static void paint_draw_curve_cursor(Brush *brush) immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); glLineWidth(3.0f); - immBegin(GL_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); + immBegin(PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) { immVertex2fv(pos, v[j]); } @@ -969,7 +969,7 @@ static void paint_draw_curve_cursor(Brush *brush) immUniformColor4f(0.9f, 0.9f, 1.0f, 0.5f); glLineWidth(1.0f); - immBegin(GL_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); + immBegin(PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1); for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) { immVertex2fv(pos, v[j]); } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 7bc46e1741c..1b18dd4e41c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -729,7 +729,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda glLineWidth(4.0); immUniformColor4ub(0, 0, 0, 255); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2i(pos, x, y); immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); immEnd(); @@ -737,7 +737,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda glLineWidth(2.0); immUniformColor4ub(255, 255, 255, 255); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2i(pos, x, y); immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]); immEnd(); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 9fd46424dfd..d882baf6251 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -150,7 +150,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(paint->paint_cursor_col); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, x, y); immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); immEnd(); @@ -178,7 +178,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) immUniformColor4ub(0, 0, 0, paint->paint_cursor_col[3]); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); if (stroke->constrain_line) { immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); @@ -194,7 +194,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) glLineWidth(1.0f); immUniformColor4ub(255, 255, 255, paint->paint_cursor_col[3]); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); if (stroke->constrain_line) { immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 799756345c2..6d6d649b12a 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -334,7 +334,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) if (saction->flag & SACTION_MOVING) { immUniformColor3f(0.0f, 0.0f, 0.0f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, saction->timeslide, v2d->cur.ymin - EXTRA_SCROLL_PAD); immVertex2f(pos, saction->timeslide, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 274e9b0f684..0986a4bc4a7 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -79,7 +79,7 @@ static void draw_keyframe(int frame, int cfra, int sfra, float framelen, int wid int x = (frame - sfra) * framelen; if (width == 1) { - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2i(pos, x, 0); immVertex2i(pos, x, height * UI_DPI_FAC); immEnd(); @@ -447,7 +447,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - a - 1) >= 1) { glPointSize(5.0f); - immBegin(GL_POINTS, b - a - 1); + immBegin(PRIM_POINTS, b - a - 1); for (i = a; i < b; i++) { if (i != curindex) { @@ -462,7 +462,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - a) >= 2) { glLineWidth(3.0f); - immBegin(GL_LINE_STRIP, b - a); + immBegin(PRIM_LINE_STRIP, b - a); for (i = a; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -478,7 +478,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((curindex - a) >= 1) { immUniformThemeColor(TH_PATH_BEFORE); - immBegin(GL_POINTS, curindex - a); + immBegin(PRIM_POINTS, curindex - a); for (i = a; i < curindex; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -490,7 +490,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - curindex - 1) >= 1) { immUniformThemeColor(TH_PATH_AFTER); - immBegin(GL_POINTS, b - curindex - 1); + immBegin(PRIM_POINTS, b - curindex - 1); for (i = curindex + 1; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -505,7 +505,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((curindex - a + 1) >= 2) { immUniformThemeColor(TH_PATH_BEFORE); - immBegin(GL_LINE_STRIP, curindex - a + 1); + immBegin(PRIM_LINE_STRIP, curindex - a + 1); for (i = a; i <= curindex; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -517,7 +517,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin if ((b - curindex) >= 2) { immUniformThemeColor(TH_PATH_AFTER); - immBegin(GL_LINE_STRIP, b - curindex); + immBegin(PRIM_LINE_STRIP, b - curindex); for (i = curindex; i < b; i++) { immVertex2f(pos, path[i][0], path[i][1]); @@ -558,12 +558,12 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT { glPointSize(tiny ? 3.0f : 4.0f); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex2f(position, pos[0], pos[1]); immEnd(); } else { - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(position, pos[0] + px[0] * 2, pos[1]); immVertex2f(position, pos[0] + px[0] * 8, pos[1]); @@ -586,7 +586,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT gpuTranslate2fv(marker_pos); if (sc->flag & SC_SHOW_MARKER_PATTERN) { - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2fv(position, marker->pattern_corners[0]); immVertex2fv(position, marker->pattern_corners[1]); immVertex2fv(position, marker->pattern_corners[2]); @@ -670,12 +670,12 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra { glPointSize(tiny ? 1.0f : 2.0f); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex2f(position, pos[0], pos[1]); immEnd(); } else { - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(position, pos[0] + px[0] * 3, pos[1]); immVertex2f(position, pos[0] + px[0] * 7, pos[1]); @@ -697,7 +697,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glEnable(GL_COLOR_LOGIC_OP); glLogicOp(GL_NOR); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2fv(position, pos); immVertex2fv(position, marker_pos); immEnd(); @@ -743,7 +743,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra } if ((track->pat_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_PATTERN)) { - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2fv(position, marker->pattern_corners[0]); immVertex2fv(position, marker->pattern_corners[1]); immVertex2fv(position, marker->pattern_corners[2]); @@ -814,7 +814,7 @@ static void draw_marker_slide_triangle(float x, float y, float dx, float dy, int tdy += px[1]; } - immBegin(GL_TRIANGLES, 3); + immBegin(PRIM_TRIANGLES, 3); immVertex2f(pos, x, y); immVertex2f(pos, x - tdx, y); immVertex2f(pos, x, y + tdy); @@ -892,7 +892,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo glLineWidth(outline ? 3.0f : 1.0f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, 0.0f, 0.0f); immVertex2fv(pos, tilt_ctrl); immEnd(); @@ -1186,7 +1186,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane glLineWidth(thick ? 3.0f : 1.0f); /* Draw rectangle itself. */ - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2fv(pos, plane_marker->corners[0]); immVertex2fv(pos, plane_marker->corners[1]); immVertex2fv(pos, plane_marker->corners[2]); @@ -1199,7 +1199,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane immUniformColor3f(1.0f, 0.0f, 0.0f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[1], end_point); immVertex2fv(pos, plane_marker->corners[0]); @@ -1209,7 +1209,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane immUniformColor3f(0.0f, 1.0f, 0.0f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); getArrowEndPoint(width, height, sc->zoom, plane_marker->corners[0], plane_marker->corners[3], end_point); immVertex2fv(pos, plane_marker->corners[0]); @@ -1468,7 +1468,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie immUniformColor3f(1.0f, 0.0f, 0.0f); } - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); if (undistort) { immVertex2f(position, pos[0] / width, pos[1] / (height * aspy)); @@ -1624,7 +1624,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, immUniformColor3f(1.0f, 0.0f, 0.0f); for (i = 0; i <= n; i++) { - immBegin(GL_LINE_STRIP, n + 1); + immBegin(PRIM_LINE_STRIP, n + 1); for (j = 0; j <= n; j++) { immVertex2fv(position, grid[i][j]); @@ -1634,7 +1634,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, } for (j = 0; j <= n; j++) { - immBegin(GL_LINE_STRIP, n + 1); + immBegin(PRIM_LINE_STRIP, n + 1); for (i = 0; i <= n; i++) { immVertex2fv(position, grid[i][j]); @@ -1692,7 +1692,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, sub_v2_v2v2(dpos, npos, pos); mul_v2_fl(dpos, 1.0f / steps); - immBegin(GL_LINE_STRIP, steps + 1); + immBegin(PRIM_LINE_STRIP, steps + 1); for (j = 0; j <= steps; j++) { BKE_tracking_distort_v2(tracking, pos, tpos); @@ -1705,7 +1705,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, } } else if (stroke->totpoints == 1) { - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex2f(position, stroke->points[0].x + offsx, stroke->points[0].y + offsy); immEnd(); } diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 3698fba0d54..c9db5d4a328 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -90,11 +90,11 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, immUniformColor4fv(col); if (is_point) { - immBeginAtMost(GL_POINTS, 1); + immBeginAtMost(PRIM_POINTS, 1); } else { /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + immBeginAtMost(PRIM_LINE_STRIP, track->markersnr); } } @@ -236,11 +236,11 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack * immUniformColor4fv(col); if (is_point) { /* This probably never happens here, but just in case... */ - immBeginAtMost(GL_POINTS, 1); + immBeginAtMost(PRIM_POINTS, 1); } else { /* Graph can be composed of smaller segments, if any marker is disabled */ - immBeginAtMost(GL_LINE_STRIP, track->markersnr); + immBeginAtMost(PRIM_LINE_STRIP, track->markersnr); } } } @@ -299,7 +299,7 @@ static void draw_frame_curves(SpaceClip *sc, unsigned int pos) } if (!lines) { - immBeginAtMost(GL_LINE_STRIP, reconstruction->camnr); + immBeginAtMost(PRIM_LINE_STRIP, reconstruction->camnr); lines = 1; } diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index a5096d3f171..462be829a23 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -252,7 +252,7 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene) immUniformThemeColor(TH_CFRAME); glLineWidth(2.0f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin); immVertex2f(pos, x, v2d->cur.ymax); immEnd(); @@ -295,7 +295,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) /* thin lines where the actual frames are */ glLineWidth(1.0f); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, (float)SFRA, v2d->cur.ymin); immVertex2f(pos, (float)SFRA, v2d->cur.ymax); immVertex2f(pos, (float)EFRA, v2d->cur.ymin); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 62625c3ccc5..bf47657f27d 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -497,7 +497,7 @@ static void draw_dividers(FileLayout *layout, View2D *v2d) v2[1] = v2d->cur.ymin; immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GL_LINES, vertex_ct); + immBegin(PRIM_LINES, vertex_ct); /* vertical column dividers */ sx = (int)v2d->tot.xmin; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 6c2355a415e..37ce5d8075b 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -158,7 +158,7 @@ static void draw_fcurve_selected_keyframe_vertices(FCurve *fcu, View2D *v2d, boo set_fcurve_vertex_color(fcu, sel); - immBeginAtMost(GL_POINTS, fcu->totvert); + immBeginAtMost(PRIM_POINTS, fcu->totvert); BezTriple *bezt = fcu->bezt; for (int i = 0; i < fcu->totvert; i++, bezt++) { @@ -210,7 +210,7 @@ static void draw_fcurve_selected_handle_vertices(FCurve *fcu, View2D *v2d, bool immUniform4f("outlineColor", hcolor[0], hcolor[1], hcolor[2], 1.0f); immUniformColor3fvAlpha(hcolor, 0.4f); - immBeginAtMost(GL_POINTS, fcu->totvert * 2); + immBeginAtMost(PRIM_POINTS, fcu->totvert * 2); BezTriple *bezt = fcu->bezt; BezTriple *prevbezt = NULL; @@ -410,7 +410,7 @@ static void draw_fcurve_sample_control(float x, float y, float xscale, float ysc gpuScale2f(1.0f / xscale * hsize, 1.0f / yscale * hsize); /* draw X shape */ - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, -0.7f, -0.7f); immVertex2f(pos, +0.7f, +0.7f); diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index b110f85df9a..92d44130098 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -281,7 +281,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) glEnable(GL_BLEND); glLineWidth(2.0); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, v2d->cur.xmin, y); immVertex2f(pos, v2d->cur.xmax, y); immEnd(); @@ -299,7 +299,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar) glEnable(GL_BLEND); glLineWidth(2.0); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, x, v2d->cur.ymin); immVertex2f(pos, x, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 139097979c4..554ec573a9c 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -689,14 +689,14 @@ void draw_image_sample_line(SpaceImage *sima) unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immUniformColor3ub(0, 0, 0); immVertex2fv(pos, hist->co[0]); immVertex2fv(pos, hist->co[1]); immEnd(); setlinestyle(1); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immUniformColor3ub(255, 255, 255); immVertex2fv(pos, hist->co[0]); immVertex2fv(pos, hist->co[1]); @@ -704,7 +704,6 @@ void draw_image_sample_line(SpaceImage *sima) setlinestyle(0); immUnbindProgram(); - } } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index c323d2da0ab..576e3eb2d60 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -300,7 +300,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns float cfra; /* plot the curve (over the strip's main region) */ - immBegin(GL_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); + immBegin(PRIM_LINE_STRIP, abs((int)(strip->end - strip->start) + 1)); /* sample at 1 frame intervals, and draw * - min y-val is yminc, max is y-maxc, so clamp in those regions @@ -316,7 +316,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns else { /* use blend in/out values only if both aren't zero */ if ((IS_EQF(strip->blendin, 0.0f) && IS_EQF(strip->blendout, 0.0f)) == 0) { - immBeginAtMost(GL_LINE_STRIP, 4); + immBeginAtMost(PRIM_LINE_STRIP, 4); /* start of strip - if no blendin, start straight at 1, otherwise from 0 to 1 over blendin frames */ if (IS_EQF(strip->blendin, 0.0f) == 0) { diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 9e5ae46b5ff..6620dec4130 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2163,7 +2163,7 @@ static void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNo immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, cx - 25, cy - 25); immVertex2f(pos, cx + 25, cy + 25); immVertex2f(pos, cx + 25, cy - 25); @@ -2208,7 +2208,7 @@ static void node_composit_backdrop_boxmask(SpaceNode *snode, ImBuf *backdrop, bN immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); immVertex2f(pos, x3, y3); @@ -2252,7 +2252,7 @@ static void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop immUniformColor3f(1.0f, 1.0f, 1.0f); - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); immVertex2f(pos, x3, y3); @@ -3412,7 +3412,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, immUniformThemeColorShadeAlpha(th_col3, -80, -120); glLineWidth(4.0f * px_fac); - immBegin(GL_LINE_STRIP, (LINK_RESOL + 1)); + immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1)); for (i = 0; i <= LINK_RESOL; i++) { immVertex2fv(pos, coord_array[i]); @@ -3421,7 +3421,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, immEnd(); if (drawarrow) { - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2fv(pos, arrow1); immVertex2fv(pos, arrow); immVertex2fv(pos, arrow2); @@ -3434,7 +3434,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, if (drawarrow) { immUniformThemeColorBlend(th_col1, th_col2, 0.5f); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex2fv(pos, arrow1); immVertex2fv(pos, arrow); immVertex2fv(pos, arrow2); @@ -3444,7 +3444,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, if (!do_shaded) { immUniformThemeColor(th_col1); - immBegin(GL_LINE_STRIP, (LINK_RESOL + 1)); + immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1)); for (i = 0; i <= LINK_RESOL; i++) { immVertex2fv(pos, coord_array[i]); @@ -3466,7 +3466,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); - immBegin(GL_LINE_STRIP, (LINK_RESOL + 1)); + immBegin(PRIM_LINE_STRIP, (LINK_RESOL + 1)); for (i = 0; i <= LINK_RESOL; i++) { UI_GetThemeColorBlend3ubv(th_col1, th_col2, spline_step, col); @@ -3534,7 +3534,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned pos) { - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); if (border & (NODE_LEFT | NODE_RIGHT)) { immVertex2f(pos, cent[0], v2d->cur.ymin); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 7f41fd91980..3e0adb3243f 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -779,7 +779,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * immUniform1f("outlineWidth", 1.0f); immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 0.6f); - immBeginAtMost(GL_POINTS, total_input_ct + total_output_ct); + immBeginAtMost(PRIM_POINTS, total_input_ct + total_output_ct); } /* socket inputs */ @@ -823,7 +823,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode * immUniform4f("outlineColor", c[0], c[1], c[2], 1.0f); immUniform1f("outlineWidth", 1.5f); - immBegin(GL_POINTS, selected_input_ct + selected_output_ct); + immBegin(PRIM_POINTS, selected_input_ct + selected_output_ct); if (selected_input_ct) { /* socket inputs */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 92193e93fbe..3e3e0aea346 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1653,7 +1653,7 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immThemeColorShadeAlpha(TH_BACK, -15, -200); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, 0, (float)*starty + UI_UNIT_Y); immVertex2f(pos, ar->v2d.cur.xmax, (float)*starty + UI_UNIT_Y); immEnd(); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 13847efd22a..e735c60c928 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -262,7 +262,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s glEnable(GL_BLEND); - immBegin(GL_TRIANGLE_STRIP, length * 2); + immBegin(PRIM_TRIANGLE_STRIP, length * 2); for (i = 0; i < length; i++) { float sampleoffset = startsample + ((x1_offset - x1) / stepsize + i) * samplestep; @@ -452,7 +452,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla immUniformColor4ub(0, 0, 0, 50); } - immBegin(GL_TRIANGLES, 3); + immBegin(PRIM_TRIANGLES, 3); immVertex2fv(pos, v1); immVertex2fv(pos, v2); immVertex2fv(pos, v3); @@ -1521,7 +1521,7 @@ static void draw_seq_backdrop(View2D *v2d) i = max_ii(1, ((int)v2d->cur.ymin) - 1); int line_ct = (int)v2d->cur.ymax - i + 1; immUniformThemeColor(TH_GRID); - immBegin(GL_LINES, line_ct * 2); + immBegin(PRIM_LINES, line_ct * 2); while (line_ct--) { immVertex2f(pos, v2d->cur.xmax, i); immVertex2f(pos, v2d->cur.xmin, i); @@ -1611,7 +1611,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUniformThemeColorShade(TH_BACK, -60); /* thin lines where the actual frames are */ - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, frame_sta, v2d->cur.ymin); immVertex2f(pos, frame_sta, v2d->cur.ymax); @@ -1629,7 +1629,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUniformThemeColorShade(TH_BACK, -40); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, ms->disp_range[0], v2d->cur.ymin); immVertex2f(pos, ms->disp_range[0], v2d->cur.ymax); @@ -1722,7 +1722,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) immUniformColor3f(0.2, 0.2, 0.2); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, cfra_over, v2d->cur.ymin); immVertex2f(pos, cfra_over, v2d->cur.ymax); immEnd(); diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index f5a2bde814d..148f605f68c 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -972,18 +972,18 @@ static void draw_documentation(const SpaceText *st, ARegion *ar) immUniformThemeColor(TH_BACK); immRecti(pos, x, y, x + boxw, y - boxh); immUniformThemeColor(TH_SHADE1); - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2i(pos, x, y); immVertex2i(pos, x + boxw, y); immVertex2i(pos, x + boxw, y - boxh); immVertex2i(pos, x, y - boxh); immEnd(); - immBegin(GL_LINE_LOOP, 3); + immBegin(PRIM_LINE_LOOP, 3); immVertex2i(pos, x + boxw - 10, y - 7); immVertex2i(pos, x + boxw - 4, y - 7); immVertex2i(pos, x + boxw - 7, y - 2); immEnd(); - immBegin(GL_LINE_LOOP, 3); + immBegin(PRIM_LINE_LOOP, 3); immVertex2i(pos, x + boxw - 10, y - boxh + 7); immVertex2i(pos, x + boxw - 4, y - boxh + 7); immVertex2i(pos, x + boxw - 7, y - boxh + 2); @@ -1507,7 +1507,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) /* same color as line number background */ immUniformThemeColor(TH_GRID); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2i(pos, margin_column_x, 0); immVertex2i(pos, margin_column_x, ar->winy - 2); immEnd(); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 7dbf99dda90..b0280d387e7 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -102,7 +102,7 @@ static void time_draw_sfra_efra(Scene *scene, View2D *v2d) /* thin lines where the actual frames are */ immUniformThemeColorShade(TH_BACK, -60); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, (float)PSFRA, v2d->cur.ymin); immVertex2f(pos, (float)PSFRA, v2d->cur.ymax); @@ -326,7 +326,7 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel, cons immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(color); - immBeginAtMost(GL_LINES, max_len * 2); + immBeginAtMost(PRIM_LINES, max_len * 2); for (; (ak) && (ak->cfra <= v2d->cur.xmax); ak = ak->next) diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index c241bbcd436..0f5262f0307 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -244,7 +244,7 @@ void draw_motion_path_instance(Scene *scene, immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR); - immBegin(GL_LINE_STRIP, len); + immBegin(PRIM_LINE_STRIP, len); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { short sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT); @@ -274,7 +274,7 @@ void draw_motion_path_instance(Scene *scene, /* draw little black point at each frame */ immUniformColor3ub(0, 0, 0); - immBegin(GL_POINTS, len); + immBegin(PRIM_POINTS, len); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { immVertex3fv(pos, mpv->co); @@ -290,7 +290,7 @@ void draw_motion_path_instance(Scene *scene, immUniformThemeColor(TH_TEXT_HI); } - immBegin(GL_POINTS, (len + stepsize - 1) / stepsize); + immBegin(PRIM_POINTS, (len + stepsize - 1) / stepsize); for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) { immVertex3fv(pos, mpv->co); @@ -307,7 +307,7 @@ void draw_motion_path_instance(Scene *scene, glPointSize(mpath->line_thickness + 5.0); immUniformThemeColor(TH_CFRAME); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); mpv = mpv_start + (CFRA - sfra); immVertex3fv(pos, mpv->co); @@ -393,7 +393,7 @@ void draw_motion_path_instance(Scene *scene, immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col); - immBeginAtMost(GL_POINTS, len); + immBeginAtMost(PRIM_POINTS, len); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { int frame = sfra + i; diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index da32ca19ed5..7f3cf0e3d7e 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -814,7 +814,7 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); - immBegin(GL_TRIANGLE_STRIP, 66); + immBegin(PRIM_TRIANGLE_STRIP, 66); immUniformColor4ub(255, 255, 255, 50); for (a = 0; a < 16; a++) { @@ -966,7 +966,7 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4], if (id != -1) GPU_select_load_id(id | BONESEL_BONE); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); add_v3_v3v3(vec, headvec, norvech); immVertex3fv(pos, vec); @@ -1169,7 +1169,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned if (id != -1) GPU_select_load_id(id | BONESEL_BONE); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); @@ -1184,7 +1184,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned if (G.f & G_PICKSEL) GPU_select_load_id(id | BONESEL_ROOT); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); } @@ -1193,7 +1193,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned if (G.f & G_PICKSEL) GPU_select_load_id(id | BONESEL_TIP); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immEnd(); @@ -1221,7 +1221,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv(fcolor); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); @@ -1237,7 +1237,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned else UI_GetThemeColor4fv(TH_VERTEX, fcolor); } immUniformColor4fv(fcolor); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immEnd(); } @@ -1250,7 +1250,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned else UI_GetThemeColor4fv(TH_VERTEX, fcolor); } immUniformColor4fv(fcolor); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3f(pos, 0.0f, 1.0f, 0.0f); immEnd(); } @@ -1466,7 +1466,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len gpuPushMatrix(); gpuMultMatrix3D(bbone->mat); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immVertex3f(pos, 0.0f, dlen, 0.0f); immEnd(); @@ -1477,7 +1477,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len else { gpuPushMatrix(); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, 0.0f); immVertex3f(pos, 0.0f, length, 0.0f); immEnd(); @@ -1671,7 +1671,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) } if (parchan) { - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, ik_tip); immVertex3fv(pos, parchan->pose_head); immEnd(); @@ -1697,7 +1697,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) } /* Only draw line in case our chain is more than one bone long! */ if (parchan != pchan) { /* XXX revise the breaking conditions to only stop at the tail? */ - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, ik_tip); immVertex3fv(pos, parchan->pose_head); immEnd(); @@ -1744,7 +1744,7 @@ static void draw_dof_ellipse(unsigned int pos, float ax, float az) immUniformColor4ub(70, 70, 70, 50); - immBegin(GL_TRIANGLES, tri*3); + immBegin(PRIM_TRIANGLES, tri*3); pz = 0.0f; for (i = 1; i < n; i++) { z = staticSine[i]; @@ -1779,7 +1779,7 @@ static void draw_dof_ellipse(unsigned int pos, float ax, float az) immUniformColor3ub(0, 0, 0); - immBegin(GL_LINE_STRIP, n); + immBegin(PRIM_LINE_STRIP, n); for (i = 0; i < n; i++) imm_sphere_project(pos, staticSine[n - i - 1] * ax, staticSine[i] * az); immEnd(); @@ -1857,7 +1857,7 @@ static void draw_pose_dofs(Object *ob) gpuRotateAxis(theta, 'Z'); immUniformColor3ub(50, 50, 255); /* blue, Z axis limit */ - immBegin(GL_LINE_STRIP, 33); + immBegin(PRIM_LINE_STRIP, 33); for (a = -16; a <= 16; a++) { /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */ float fac = ((float)a) / 16.0f * 0.5f; @@ -1882,7 +1882,7 @@ static void draw_pose_dofs(Object *ob) gpuRotateAxis(theta, 'X'); immUniformColor3ub(255, 50, 50); /* Red, X axis limit */ - immBegin(GL_LINE_STRIP, 33); + immBegin(PRIM_LINE_STRIP, 33); for (a = -16; a <= 16; a++) { /* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */ float fac = ((float)a) / 16.0f * 0.5f; @@ -2213,7 +2213,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion * } setlinestyle(3); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, pchan->pose_head); immVertex3fv(pos, pchan->parent->pose_tail); immEnd(); @@ -2511,7 +2511,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) immUniformColor4fv(fcolor); setlinestyle(3); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, eBone->head); immVertex3fv(pos, eBone->parent->tail); immEnd(); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 291592a0a4c..930df90b9cc 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -550,7 +550,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const switch (drawtype) { case OB_PLAINAXES: - immBegin(GL_LINES, 6); + immBegin(PRIM_LINES, 6); for (axis = 0; axis < 3; axis++) { v1[axis] = size; v2[axis] = -size; @@ -564,7 +564,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const break; case OB_SINGLE_ARROW: - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); /* in positive z direction only */ v1[2] = size; immVertex3fv(pos, v1); @@ -572,7 +572,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const immEnd(); /* square pyramid */ - immBegin(GL_TRIANGLES, 12); + immBegin(PRIM_TRIANGLES, 12); v2[0] = size * 0.035f; v2[1] = size * 0.035f; v3[0] = size * -0.035f; v3[1] = size * 0.035f; @@ -622,7 +622,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const for (axis = 0; axis < 3; axis++) { const int arrow_axis = (axis == 0) ? 1 : 0; - immBegin(GL_LINES, 6); + immBegin(PRIM_LINES, 6); v2[axis] = size; immVertex3fv(pos, v1); @@ -712,7 +712,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char immUniform1f("alpha", ob_alpha); immUniform1i("image", 0); /* default GL_TEXTURE0 unit */ - immBegin(GL_TRIANGLE_FAN, 4); + immBegin(PRIM_TRIANGLE_FAN, 4); immAttrib2f(texCoord, 0.0f, 0.0f); immVertex2f(pos, left, bottom); @@ -785,7 +785,7 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], un circball_array_fill(verts, cent, rad, tmat); - immBegin(GL_LINE_LOOP, CIRCLE_RESOL); + immBegin(PRIM_LINE_LOOP, CIRCLE_RESOL); for (int i = 0; i < CIRCLE_RESOL; ++i) { immVertex3fv(pos, verts[i]); } @@ -826,7 +826,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *UNUSED(rv3d), const floa immUniform4fv("outlineColor", outlineColor); immUniform1f("outlineWidth", outlineWidth); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, co); immEnd(); @@ -1020,7 +1020,7 @@ static void drawcube_size(float size, unsigned pos) glDrawRangeElements(GL_LINES, 0, 7, 24, GL_UNSIGNED_BYTE, indices); glDisableClientState(GL_VERTEX_ARRAY); #else - immBegin(GL_LINES, 24); + immBegin(PRIM_LINES, 24); for (int i = 0; i < 24; ++i) { immVertex3fv(pos, verts[indices[i]]); } @@ -1038,13 +1038,13 @@ static void drawshadbuflimits(const Lamp *la, const float mat[4][4], unsigned po madd_v3_v3v3fl(sta, mat[3], lavec, la->clipsta); madd_v3_v3v3fl(end, mat[3], lavec, la->clipend); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, sta); immVertex3fv(pos, end); immEnd(); glPointSize(3.0f); - immBegin(GL_POINTS, 2); + immBegin(PRIM_POINTS, 2); immVertex3fv(pos, sta); immVertex3fv(pos, end); immEnd(); @@ -1119,7 +1119,7 @@ static void draw_spot_cone(Lamp *la, float x, float z, unsigned pos) const bool square = (la->mode & LA_SQUARE); - immBegin(GL_TRIANGLE_FAN, square ? 6 : 34); + immBegin(PRIM_TRIANGLE_FAN, square ? 6 : 34); immVertex3f(pos, 0.0f, 0.0f, -x); if (square) { @@ -1310,7 +1310,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, immUniformColor3fvAlpha(color, 0.3f); immUniform4fv("outlineColor", color); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); @@ -1326,7 +1326,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, /* color doesn't matter, so don't set */ glPointSize(lampdot_size); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); @@ -1381,7 +1381,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, setlinestyle(3); - immBegin(GL_LINES, 16); + immBegin(PRIM_LINES, 16); for (axis = 0; axis < 8; axis++) { immVertex3fv(pos, v1); immVertex3fv(pos, v2); @@ -1434,7 +1434,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, {-z_abs, z_abs, x}, }; - immBegin(GL_LINES, 16); + immBegin(PRIM_LINES, 16); for (int i = 1; i <= 4; ++i) { immVertex3fv(pos, vertices[0]); /* apex to corner */ immVertex3fv(pos, vertices[i]); @@ -1460,7 +1460,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, } else { /* draw the angled sides of the cone */ - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); immVertex3fv(pos, vvec); immVertex3fv(pos, vec); immVertex3fv(pos, lvec); @@ -1488,7 +1488,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, /* draw clip start, useful for wide cones where its not obvious where the start is */ gpuTranslate3f(0.0f, 0.0f, -x); /* reverse translation above */ - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); if (la->type == LA_SPOT && (la->mode & LA_SHAD_BUF)) { float lvec_clip[3]; float vvec_clip[3]; @@ -1509,7 +1509,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, } else if (ELEM(la->type, LA_HEMI, LA_SUN)) { /* draw the line from the circle along the dist */ - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); vec[2] = -circrad; immVertex3fv(pos, vec); vec[2] = -la->dist; @@ -1529,7 +1529,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, float v[3] = {0.0f, 0.0f, 0.0f}; zdist = 0.02f; - immBegin(GL_LINE_STRIP, 6); + immBegin(PRIM_LINE_STRIP, 6); for (steps = 0; steps < 6; steps++) { if (axis == 0 || axis == 1) { /* x axis up, x axis down */ @@ -1568,7 +1568,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, else if (la->area_shape == LA_AREA_RECT) imm_draw_line_box_3d(pos, -la->area_size * 0.5f, -la->area_sizey * 0.5f, la->area_size * 0.5f, la->area_sizey * 0.5f); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, -circrad); immVertex3f(pos, 0.0f, 0.0f, -la->dist); immEnd(); @@ -1594,14 +1594,14 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, if (vec[2] > 0) vec[2] -= circrad; else vec[2] += circrad; - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, vec); vec[2] = 0; immVertex3fv(pos, vec); immEnd(); glPointSize(2.0f); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); @@ -1613,7 +1613,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, static void draw_limit_line(float sta, float end, const short dflag, const unsigned char col[3], unsigned pos) { - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3f(pos, 0.0f, 0.0f, -sta); immVertex3f(pos, 0.0f, 0.0f, -end); immEnd(); @@ -1622,7 +1622,7 @@ static void draw_limit_line(float sta, float end, const short dflag, const unsig glPointSize(3.0f); /* would like smooth round points here, but that means binding another shader... * if it's really desired, pull these points into their own function to be called after */ - immBegin(GL_POINTS, 2); + immBegin(PRIM_POINTS, 2); if ((dflag & DRAW_CONSTCOLOR) == 0) { immUniformColor3ubv(col); } @@ -1637,7 +1637,7 @@ static void draw_limit_line(float sta, float end, const short dflag, const unsig /* qdn: now also enabled for Blender to set focus point for defocus composite node */ static void draw_focus_cross(float dist, float size, unsigned pos) { - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex3f(pos, -size, 0.0f, -dist); immVertex3f(pos, size, 0.0f, -dist); immVertex3f(pos, 0.0f, -size, -dist); @@ -1823,7 +1823,7 @@ static void draw_viewport_object_reconstruction( glLineWidth(2.0f); - immBegin(GL_LINE_STRIP, reconstruction->camnr); + immBegin(PRIM_LINE_STRIP, reconstruction->camnr); for (int a = 0; a < reconstruction->camnr; a++, camera++) { immVertex3fv(pos, camera->mat[3]); } @@ -1887,7 +1887,7 @@ static void drawcamera_frame(float vec[4][3], bool filled, unsigned pos) /* center point to camera frame */ static void drawcamera_framelines(float vec[4][3], float origin[3], unsigned pos) { - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex3fv(pos, origin); immVertex3fv(pos, vec[0]); immVertex3fv(pos, origin); @@ -1928,7 +1928,7 @@ static void drawcamera_volume(float near_plane[4][3], float far_plane[4][3], boo immEnd(); } else { - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); for (int i = 0; i < 4; ++i) { immVertex3fv(pos, near_plane[i]); immVertex3fv(pos, far_plane[i]); @@ -2012,7 +2012,7 @@ static void drawcamera_stereo3d( glLineStipple(2, 0xAAAA); glEnable(GL_LINE_STIPPLE); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, origin[0]); immVertex3fv(pos, origin[1]); immEnd(); @@ -2213,10 +2213,10 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, * for active cameras. We actually draw both outline+filled * for active cameras so the wire can be seen side-on */ for (int i = 0; i < 2; i++) { - if (i == 0) immBegin(GL_LINE_LOOP, 3); + if (i == 0) immBegin(PRIM_LINE_LOOP, 3); else if (i == 1 && is_active) { glDisable(GL_CULL_FACE); /* TODO: declarative state tracking */ - immBegin(GL_TRIANGLES, 3); + immBegin(PRIM_TRIANGLES, 3); } else break; @@ -2292,7 +2292,7 @@ void drawspeaker(const unsigned char ob_wire_col[3]) for (int j = 0; j < 3; j++) { float z = 0.25f * j - 0.125f; - immBegin(GL_LINE_LOOP, segments); + immBegin(PRIM_LINE_LOOP, segments); for (int i = 0; i < segments; i++) { float x = cosf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); float y = sinf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f); @@ -2304,7 +2304,7 @@ void drawspeaker(const unsigned char ob_wire_col[3]) for (int j = 0; j < 4; j++) { float x = (((j + 1) % 2) * (j - 1)) * 0.5f; float y = ((j % 2) * (j - 2)) * 0.5f; - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); for (int i = 0; i < 3; i++) { if (i == 1) { x *= 0.5f; @@ -2331,7 +2331,7 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s UI_GetThemeColor4fv(TH_ACTIVE_VERT, active_color); glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GL_POINTS, lt->pntsw * lt->pntsv * lt->pntsu); + immBeginAtMost(PRIM_POINTS, lt->pntsw * lt->pntsv * lt->pntsu); for (int w = 0; w < lt->pntsw; w++) { int wxt = (w == 0 || w == lt->pntsw - 1); @@ -2465,7 +2465,7 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign } glLineWidth(1.0f); - immBeginAtMost(GL_LINES, lt->pntsw * lt->pntsv * lt->pntsu * 6); + immBeginAtMost(PRIM_LINES, lt->pntsw * lt->pntsv * lt->pntsu * 6); for (w = 0; w < lt->pntsw; w++) { int wxt = (w == 0 || w == lt->pntsw - 1); @@ -2567,7 +2567,7 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBeginAtMost(GL_POINTS, dm->getNumVerts(dm)); + immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm)); dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -2641,7 +2641,7 @@ static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(theme_id); - immBeginAtMost(GL_LINES, dm->getNumPolys(dm) * 2); + immBeginAtMost(PRIM_LINES, dm->getNumPolys(dm) * 2); dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); immEnd(); @@ -2673,7 +2673,7 @@ static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, bool select, c immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(fcol); - immBeginAtMost(GL_POINTS, dm->getNumPolys(dm)); + immBeginAtMost(PRIM_POINTS, dm->getNumPolys(dm)); dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -2727,7 +2727,7 @@ static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformThemeColor(theme_id); - immBeginAtMost(GL_LINES, dm->getNumVerts(dm) * 2); + immBeginAtMost(PRIM_LINES, dm->getNumVerts(dm) * 2); dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); immEnd(); @@ -2801,7 +2801,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GL_POINTS, dm->getNumVerts(dm)); + immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm)); dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -3145,7 +3145,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv calcDrawDMNormalScale(ob, &data); - immBeginAtMost(GL_LINES, dm->getNumLoops(dm) * 2); + immBeginAtMost(PRIM_LINES, dm->getNumLoops(dm) * 2); dm->foreachMappedLoop(dm, draw_dm_loop_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); immEnd(); @@ -3323,7 +3323,7 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm) glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2.0f); - immBeginAtMost(GL_POINTS, dm->getNumVerts(dm)); + immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm)); dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -6322,7 +6322,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv } if (count > 0) { - immBegin(GL_LINES, count * 2); + immBegin(PRIM_LINES, count * 2); for (a = 0, pa = psys->particles; a < totpart; a++, pa++) { for (i = 1; i < pa->totkey; ++i) { float v1[3], v2[3]; @@ -6359,7 +6359,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv else immUniformThemeColor(TH_WIRE); - immBegin(GL_LINES, 24); + immBegin(PRIM_LINES, 24); immVertex3f(pos_id, gmin[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmin[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmax[1], gmin[2]); immVertex3f(pos_id, gmax[0], gmax[1], gmin[2]); immVertex3f(pos_id, gmin[0], gmax[1], gmin[2]); @@ -6388,7 +6388,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if (count >= 2) { glEnable(GL_BLEND); - immBegin(GL_LINES, count); + immBegin(PRIM_LINES, count); for (i = 1; i < res[0] - 1; ++i) { float f = interpf(gmax[0], gmin[0], (float)i / (float)(res[0] - 1)); immVertex3f(pos_id, f, gmin[1], gmin[2]); immVertex3f(pos_id, f, gmax[1], gmin[2]); @@ -6705,7 +6705,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT); unsigned int col_id = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBeginAtMost(GL_POINTS, totpoint); + immBeginAtMost(PRIM_POINTS, totpoint); for (i = 0, point = edit->points; i < totpoint; i++, point++) { if ((point->flag & PEP_HIDE) == 0 && point->totkey) { PTCacheEditKey *key = point->keys + point->totkey - 1; @@ -6742,7 +6742,7 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(GL_LINES, 30); + immBegin(PRIM_LINES, 30); immAttrib4ub(col, 0x7F, 0x00, 0x00, 155); root[1] = root[2] = 0.0f; @@ -6896,7 +6896,7 @@ static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles) glLineWidth(1.0f); - immBeginAtMost(GL_LINES, nu->pntsu * 4); + immBeginAtMost(PRIM_LINES, nu->pntsu * 4); BezTriple *bezt = nu->bezt; int a = nu->pntsu; @@ -6950,7 +6950,7 @@ static void drawhandlesN_active(Nurb *nu) immUniformThemeColor(TH_ACTIVE_SPLINE); glLineWidth(2.0f); - immBeginAtMost(GL_LINES, nu->pntsu * 4); + immBeginAtMost(PRIM_LINES, nu->pntsu * 4); BezTriple *bezt = nu->bezt; int a = nu->pntsu; while (a--) { @@ -7002,7 +7002,7 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GL_POINTS, count); + immBeginAtMost(PRIM_POINTS, count); for (nu = nurb; nu; nu = nu->next) { @@ -7072,8 +7072,8 @@ static void editnurb_draw_active_poly(Nurb *nu) BPoint *bp = nu->bp; for (int b = 0; b < nu->pntsv; b++) { if (nu->pntsu >= 2) { - if (nu->flagu & 1) immBegin(GL_LINE_LOOP, nu->pntsu); - else immBegin(GL_LINE_STRIP, nu->pntsu); + if (nu->flagu & 1) immBegin(PRIM_LINE_LOOP, nu->pntsu); + else immBegin(PRIM_LINE_STRIP, nu->pntsu); for (int a = 0; a < nu->pntsu; a++, bp++) { immVertex3fv(pos, bp->vec); @@ -7100,7 +7100,7 @@ static void editnurb_draw_active_nurbs(Nurb *nu) if (nu->pntsv > 1) count += (nu->pntsv - 1) * nu->pntsu * 2; if (count < 2) return; - immBeginAtMost(GL_LINES, count); + immBeginAtMost(PRIM_LINES, count); BPoint *bp = nu->bp; for (int b = 0; b < nu->pntsv; b++) { BPoint *bp1 = bp; @@ -7167,8 +7167,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) bp = nu->bp; for (b = 0; b < nu->pntsv; b++) { if (nu->pntsu >= 2) { - if (nu->flagu & 1) immBegin(GL_LINE_LOOP, nu->pntsu); - else immBegin(GL_LINE_STRIP, nu->pntsu); + if (nu->flagu & 1) immBegin(PRIM_LINE_LOOP, nu->pntsu); + else immBegin(PRIM_LINE_STRIP, nu->pntsu); for (a = 0; a < nu->pntsu; a++, bp++) { immVertex3fv(pos, bp->vec); @@ -7199,7 +7199,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel) glLineWidth(1.0f); - immBeginAtMost(GL_LINES, count); + immBeginAtMost(PRIM_LINES, count); bp = nu->bp; for (b = 0; b < nu->pntsv; b++) { @@ -7341,7 +7341,7 @@ static void draw_editnurb( } if (count > 2) { - immBegin(GL_LINES, count); + immBegin(PRIM_LINES, count); for (bl = ob->curve_cache->bev.first, nu = nurb; nu && bl; bl = bl->next, nu = nu->next) { BevPoint *bevp = bl->bevpoints; int nr = bl->nr; @@ -7396,7 +7396,7 @@ static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2]) set_inverted_drawing(1); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); imm_cpack(0); - immBegin(GL_TRIANGLE_FAN, 4); + immBegin(PRIM_TRIANGLE_FAN, 4); immVertex2fv(pos, textcurs[0]); immVertex2fv(pos, textcurs[1]); immVertex2fv(pos, textcurs[2]); @@ -7439,7 +7439,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 vec1[1] += cu->linedist * cu->fsize; vec2[1] -= cu->lines * cu->linedist * cu->fsize; setlinestyle(3); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2fv(pos, vec1); immVertex2fv(pos, vec2); immEnd(); @@ -7456,7 +7456,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 vec1[0] = cu->xof + cu->tb[i].x; vec1[1] = cu->yof + cu->tb[i].y + cu->fsize; vec1[2] = 0.001; - immBegin(GL_LINE_STRIP, 5); + immBegin(PRIM_LINE_STRIP, 5); immVertex3fv(pos, vec1); vec1[0] += cu->tb[i].w; immVertex3fv(pos, vec1); @@ -7498,7 +7498,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3 /* fill in xy below */ tvec[2] = 0.001; - immBegin(GL_TRIANGLE_FAN, 4); + immBegin(PRIM_TRIANGLE_FAN, 4); if (sb->rot == 0.0f) { copy_v2_fl2(tvec, sb->x, sb->y); @@ -7556,15 +7556,15 @@ static void draw_empty_sphere(float size, unsigned pos) p[i][1] = size * sinf(angle); } - immBegin(GL_LINE_LOOP, NSEGMENTS); + immBegin(PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, p[i][0], p[i][1], 0.0f); immEnd(); - immBegin(GL_LINE_LOOP, NSEGMENTS); + immBegin(PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, p[i][0], 0.0f, p[i][1]); immEnd(); - immBegin(GL_LINE_LOOP, NSEGMENTS); + immBegin(PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, 0.0f, p[i][0], p[i][1]); immEnd(); @@ -7584,7 +7584,7 @@ static void draw_empty_cone(float size, unsigned pos) } /* cone sides */ - immBegin(GL_LINES, NSEGMENTS * 2); + immBegin(PRIM_LINES, NSEGMENTS * 2); for (int i = 0; i < NSEGMENTS; ++i) { immVertex3f(pos, 0.0f, 2.0f * size, 0.0f); immVertex3f(pos, p[i][0], 0.0f, p[i][1]); @@ -7592,7 +7592,7 @@ static void draw_empty_cone(float size, unsigned pos) immEnd(); /* end ring */ - immBegin(GL_LINE_LOOP, NSEGMENTS); + immBegin(PRIM_LINE_LOOP, NSEGMENTS); for (int i = 0; i < NSEGMENTS; ++i) immVertex3f(pos, p[i][0], 0.0f, p[i][1]); immEnd(); @@ -7615,7 +7615,7 @@ static void drawspiral(unsigned int pos, const float cent[3], float rad, float t mul_v3_v3fl(vx, tmat[0], rad); mul_v3_v3fl(vy, tmat[1], rad); - immBegin(GL_LINE_STRIP, CIRCLE_RESOL + 1); + immBegin(PRIM_LINE_STRIP, CIRCLE_RESOL + 1); if (inverse == 0) { copy_v3_v3(vec, cent); @@ -7669,7 +7669,7 @@ static void drawspiral(unsigned int pos, const float cent[3], float rad, float t * all required matrices have been set (used for drawing empties) */ static void drawcircle_size(float size, unsigned pos) { - immBegin(GL_LINE_LOOP, CIRCLE_RESOL); + immBegin(PRIM_LINE_LOOP, CIRCLE_RESOL); /* coordinates are: cos(degrees * 11.25) = x, sin(degrees * 11.25) = y, 0.0f = z */ for (short degrees = 0; degrees < CIRCLE_RESOL; degrees++) { @@ -7693,7 +7693,7 @@ static void imm_drawtube(const float vec[3], float radius, float height, float t imm_drawcircball(cur, radius, tmat, pos); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex3f(pos, vec[0] + radius, vec[1], vec[2]); immVertex3f(pos, cur[0] + radius, cur[1], cur[2]); immVertex3f(pos, vec[0] - radius, vec[1], vec[2]); @@ -7715,7 +7715,7 @@ static void imm_drawcone(const float vec[3], float radius, float height, float t imm_drawcircball(cur, radius, tmat, pos); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex3f(pos, vec[0], vec[1], vec[2]); immVertex3f(pos, cur[0] + radius, cur[1], cur[2]); immVertex3f(pos, vec[0], vec[1], vec[2]); @@ -8297,7 +8297,7 @@ static void draw_hooks(Object *ob, unsigned int pos) if (hmd->object) { setlinestyle(3); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, hmd->object->obmat[3]); immVertex3fv(pos, vec); immEnd(); @@ -8305,7 +8305,7 @@ static void draw_hooks(Object *ob, unsigned int pos) } glPointSize(3.0f); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, vec); immEnd(); } @@ -8327,7 +8327,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, glLineWidth(4.0f); setlinestyle(2); - immBegin(GL_LINES, 6); + immBegin(PRIM_LINES, 6); for (int axis = 0; axis < 3; axis++) { float dir[3] = {0, 0, 0}; float v[3]; @@ -9127,7 +9127,7 @@ afterdraw: /* TODO: short term, use DEPTH_ONLY shader or set appropriate color */ /* TODO: long term, solve picking & selection problem better */ glPointSize(U.obcenter_dia); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immVertex3fv(pos, ob->obmat[3]); immEnd(); immUnbindProgram(); @@ -9162,7 +9162,7 @@ afterdraw: /* help lines and so */ if (ob != scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) { setlinestyle(3); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, ob->obmat[3]); immVertex3fv(pos, ob->orig); immEnd(); @@ -9204,7 +9204,7 @@ afterdraw: if (camob) { setlinestyle(3); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, camob->obmat[3]); immVertex3fv(pos, ob->obmat[3]); immEnd(); @@ -9228,7 +9228,7 @@ afterdraw: unit_m4(ct->matrix); setlinestyle(3); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, ct->matrix[3]); immVertex3fv(pos, ob->obmat[3]); immEnd(); @@ -9248,7 +9248,7 @@ afterdraw: immUniformThemeColor(TH_WIRE); setlinestyle(3); - immBegin(GL_LINES, ((int)((bool)rbc->ob1) + (int)((bool)rbc->ob2)) * 2); + immBegin(PRIM_LINES, ((int)((bool)rbc->ob1) + (int)((bool)rbc->ob2)) * 2); if (rbc->ob1) { immVertex3fv(pos, ob->obmat[3]); immVertex3fv(pos, rbc->ob1->obmat[3]); @@ -9344,7 +9344,7 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GL_POINTS, dm->getNumVerts(dm)); + immBeginAtMost(PRIM_POINTS, dm->getNumVerts(dm)); dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -9377,7 +9377,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); - immBeginAtMost(GL_POINTS, em->bm->totvert); + immBeginAtMost(PRIM_POINTS, em->bm->totvert); dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); immEnd(); @@ -9467,7 +9467,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d, glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); - immBeginAtMost(GL_POINTS, em->bm->totface); + immBeginAtMost(PRIM_POINTS, em->bm->totface); dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP); immEnd(); diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c index da39a81a4d8..c38b1ada29e 100644 --- a/source/blender/editors/space_view3d/drawsimdebug.c +++ b/source/blender/editors/space_view3d/drawsimdebug.c @@ -73,7 +73,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) /**** dots ****/ glPointSize(3.0f); - immBegin(GL_POINTS, num_dots); + immBegin(PRIM_POINTS, num_dots); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); if (elem->type != SIM_DEBUG_ELEM_DOT) @@ -94,7 +94,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) {-0.000000, -1.000000}, {-0.382683, -0.923880}, {-0.707107, -0.707107}, {-0.923879, -0.382684}, {-1.000000, 0.000000}, {-0.923879, 0.382684}, {-0.707107, 0.707107}, {-0.382683, 0.923880} }; - immBegin(GL_LINES, num_circles * CIRCLERES * 2); + immBegin(PRIM_LINES, num_circles * CIRCLERES * 2); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); @@ -130,7 +130,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) /**** lines ****/ - immBegin(GL_LINES, num_lines * 2); + immBegin(PRIM_LINES, num_lines * 2); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); if (elem->type != SIM_DEBUG_ELEM_LINE) @@ -145,7 +145,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) /**** vectors ****/ glPointSize(2.0f); - immBegin(GL_POINTS, num_vectors); + immBegin(PRIM_POINTS, num_vectors); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); if (elem->type != SIM_DEBUG_ELEM_VECTOR) @@ -156,7 +156,7 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4]) } immEnd(); - immBegin(GL_LINES, num_vectors * 2); + immBegin(PRIM_LINES, num_vectors * 2); for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) { SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); float t[3]; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a3bdc09143f..0d5e6440355 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -426,7 +426,7 @@ static void drawviewborder_grid3(unsigned pos, float x1, float x2, float y1, flo x4 = x1 + (1.0f - fac) * (x2 - x1); y4 = y1 + (1.0f - fac) * (y2 - y1); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(pos, x1, y3); immVertex2f(pos, x2, y3); @@ -448,7 +448,7 @@ static void drawviewborder_triangle(unsigned pos, float x1, float x2, float y1, float w = x2 - x1; float h = y2 - y1; - immBegin(GL_LINES, 6); + immBegin(PRIM_LINES, 6); if (w > h) { if (golden) { ofs = w * (1.0f - (1.0f / 1.61803399f)); @@ -602,7 +602,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) y3 = y1 + 0.5f * (y2 - y1); immUniformThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25f, 0); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, x1, y3); immVertex2f(pos, x2, y3); @@ -616,7 +616,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if (ca->dtx & CAM_DTX_CENTER_DIAG) { immUniformThemeColorBlendShade(TH_VIEW_OVERLAY, TH_BACK, 0.25f, 0); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, x1, y1); immVertex2f(pos, x2, y2); @@ -1146,7 +1146,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** if (gridline_ct == 0) goto drawgrid_cleanup; /* nothing to draw */ - immBegin(GL_LINES, gridline_ct * 2); + immBegin(PRIM_LINES, gridline_ct * 2); } float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar); @@ -1206,7 +1206,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** if (gridline_ct == 0) goto drawgrid_cleanup; /* nothing to draw */ - immBegin(GL_LINES, gridline_ct * 2); + immBegin(PRIM_LINES, gridline_ct * 2); if (grids_to_draw == 2) { UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2); @@ -1289,7 +1289,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(GL_LINES, vertex_ct); + immBegin(PRIM_LINES, vertex_ct); /* draw normal grid lines */ UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10); @@ -1376,7 +1376,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR); - immBegin(GL_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); + immBegin(PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2); if (show_axis_x) { UI_make_axis_color(col_grid, col_axis, 'X'); @@ -1535,7 +1535,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) const int segments = 16; - immBegin(GL_LINE_LOOP, segments); + immBegin(PRIM_LINE_LOOP, segments); for (int i = 0; i < segments; ++i) { float angle = 2 * M_PI * ((float)i / (float)segments); @@ -1562,7 +1562,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color); immUniformColor3ubv(crosshair_color); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(pos, co[0] - f20, co[1]); immVertex2f(pos, co[0] - f5, co[1]); immVertex2f(pos, co[0] + f5, co[1]); @@ -1617,7 +1617,7 @@ static void draw_view_axis(RegionView3D *rv3d, rcti *rect) unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GL_LINES, 6); + immBegin(PRIM_LINES, 6); for (int axis_i = 0; axis_i < 3; axis_i++) { int i = axis_order[axis_i]; @@ -1669,7 +1669,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) mul_v3_v3fl(scaled_axis, rv3d->rot_axis, scale); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); color[3] = 0; /* more transparent toward the ends */ immAttrib4ubv(col, color); add_v3_v3v3(end, o, scaled_axis); @@ -1708,7 +1708,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) axis_angle_to_quat(q, vis_axis, vis_angle); } - immBegin(GL_LINE_LOOP, ROT_AXIS_DETAIL); + immBegin(PRIM_LINE_LOOP, ROT_AXIS_DETAIL); color[3] = 63; /* somewhat faint */ immAttrib4ubv(col, color); float angle = 0.0f; @@ -1737,7 +1737,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) /* -- draw rotation center -- */ immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR); glPointSize(5.0f); - immBegin(GL_POINTS, 1); + immBegin(PRIM_POINTS, 1); immAttrib4ubv(col, color); immVertex3fv(pos, o); immEnd(); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index c324cb7b251..1a8ac374e75 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -266,7 +266,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), immUniformThemeColor(TH_VIEW_OVERLAY); - immBegin(GL_LINES, 16); + immBegin(PRIM_LINES, 16); /* bottom left */ immVertex2f(pos, x1, y1); diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index edec14f92af..6e9a2c642b6 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -465,7 +465,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); imm_cpack(is_act ? color_act : color_base); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); for (j = 0; j < 3; j++) { immVertex2fv(pos, co_ss[j]); @@ -476,7 +476,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a imm_cpack(0xaaaaaa); setlinestyle(3); - immBegin(GL_LINE_STRIP, 3); + immBegin(PRIM_LINE_STRIP, 3); for (j = 0; j < 3; j++) { immVertex2fv(pos, co_ss[j]); @@ -516,7 +516,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(GL_LINE_STRIP, arc_steps + 1); + immBegin(PRIM_LINE_STRIP, arc_steps + 1); for (j = 0; j <= arc_steps; j++) { madd_v3_v3v3fl(co_tmp, ruler_item->co[1], dir_tmp, px_scale); @@ -549,7 +549,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec_a, cap_size); immVertex2fv(pos, cap); @@ -607,7 +607,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); imm_cpack(is_act ? color_act : color_base); - immBegin(GL_LINE_STRIP, 2); + immBegin(PRIM_LINE_STRIP, 2); for (j = 0; j < 3; j += 2) { immVertex2fv(pos, co_ss[j]); @@ -618,7 +618,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a imm_cpack(0xaaaaaa); setlinestyle(3); - immBegin(GL_LINE_STRIP, 2); + immBegin(PRIM_LINE_STRIP, 2); for (j = 0; j < 3; j += 2) { immVertex2fv(pos, co_ss[j]); @@ -641,7 +641,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a immUniformColor3ubv(color_wire); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); madd_v2_v2v2fl(cap, co_ss[0], rot_90_vec, cap_size); immVertex2fv(pos, cap); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 48c16de4dbe..5126f305e08 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -347,7 +347,7 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a immUniformThemeColor(TH_VIEW_OVERLAY); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); /* North */ immVertex2i(pos, xoff, yoff + inner_length); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index cd724370e17..328d6afb6a4 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -735,7 +735,7 @@ void drawConstraint(TransInfo *t) setlinestyle(1); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, t->center_global); immVertex3fv(pos, vec); immEnd(); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 3e427d2973b..1d67b574fd0 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1057,7 +1057,7 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor3ubv(col2); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3fv(pos, v1); immVertex3fv(pos, v2); immEnd(); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 162808e3eb3..02975f73816 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -189,7 +189,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) if (usingSnappingNormal(t) && validSnappingNormal(t)) { immUniformColor4ubv(activeCol); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex3f(pos, t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]); immVertex3f(pos, t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0], t->tsnap.snapPoint[1] + t->tsnap.snapNormal[1], diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 8bf0b2eb020..0cb8f82f940 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -326,7 +326,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformThemeColor(TH_VIEW_OVERLAY); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2fv(pos, mval_dst); immVertex2fv(pos, mval_src); immEnd(); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index d0b581eed90..387ccd92cba 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -91,7 +91,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) imm_cpack(0xFFFFFF); - immBegin(GL_LINE_LOOP, 4); + immBegin(PRIM_LINE_LOOP, 4); immVertex2f(pos, -0.05f * x_fac, 0.0f); immVertex2f(pos, 0.0f, 0.05f * y_fac); immVertex2f(pos, 0.05f * x_fac, 0.0f); @@ -103,7 +103,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) /* drawing individual segments, because the stipple pattern * gets messed up when drawing a continuous loop */ - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(pos, -0.05f * x_fac, 0.0f); immVertex2f(pos, 0.0f, 0.05f * y_fac); immVertex2f(pos, 0.0f, 0.05f * y_fac); @@ -117,7 +117,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) setlinestyle(0); imm_cpack(0x0); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(pos, -0.020f * x_fac, 0.0f); immVertex2f(pos, -0.1f * x_fac, 0.0f); immVertex2f(pos, 0.1f * x_fac, 0.0f); @@ -131,7 +131,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) setlinestyle(1); imm_cpack(0xFFFFFF); - immBegin(GL_LINES, 8); + immBegin(PRIM_LINES, 8); immVertex2f(pos, -0.020f * x_fac, 0.0f); immVertex2f(pos, -0.1f * x_fac, 0.0f); immVertex2f(pos, 0.1f * x_fac, 0.0f); @@ -251,7 +251,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_TAG)) { - immBegin(GL_TRIANGLE_FAN, efa->len); + immBegin(PRIM_TRIANGLE_FAN, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -291,7 +291,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe immUniformColor3fv(col); /* TODO: use editmesh tessface */ - immBegin(GL_TRIANGLE_FAN, efa->len); + immBegin(PRIM_TRIANGLE_FAN, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -365,7 +365,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe } /* TODO: use editmesh tessface */ - immBegin(GL_TRIANGLE_FAN, efa->len); + immBegin(PRIM_TRIANGLE_FAN, efa->len); BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); a = fabsf(uvang[i] - ang[i]) / (float)M_PI; @@ -403,7 +403,7 @@ static void draw_uvs_lineloop_bmface(BMFace *efa, const int cd_loop_uv_offset, u BMLoop *l; MLoopUV *luv; - immBegin(GL_LINE_LOOP, efa->len); + immBegin(PRIM_LINE_LOOP, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -418,7 +418,7 @@ static void draw_uvs_lineloop_mpoly(Mesh *me, MPoly *mpoly, unsigned int pos) MLoopUV *mloopuv; int i; - immBegin(GL_LINE_LOOP, mpoly->totloop); + immBegin(PRIM_LINE_LOOP, mpoly->totloop); mloopuv = &me->mloopuv[mpoly->loopstart]; for (i = mpoly->totloop; i != 0; i--, mloopuv++) { @@ -575,7 +575,7 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, SceneLayer *sl, Ob if ((scene->toolsettings->uv_flag & UV_SHOW_SAME_IMAGE) && mpoly->mat_nr != ob->actcol - 1) continue; - immBegin(GL_LINE_LOOP, mpoly->totloop); + immBegin(PRIM_LINE_LOOP, mpoly->totloop); mloopuv = mloopuv_base + mpoly->loopstart; for (b = 0; b < mpoly->totloop; b++, mloopuv++) { @@ -700,7 +700,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe immUniformColor4ubv(is_select ? col2 : col1); } - immBegin(GL_TRIANGLES, (em->looptris[i][0]->f->len - 2) * 3); + immBegin(PRIM_TRIANGLES, (em->looptris[i][0]->f->len - 2) * 3); draw_uvs_looptri(em, &i, cd_loop_uv_offset, pos); immEnd(); } @@ -830,7 +830,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - immBegin(GL_LINE_LOOP, efa->len); + immBegin(PRIM_LINE_LOOP, efa->len); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { sel = uvedit_uv_select_test(scene, l, cd_loop_uv_offset); @@ -854,7 +854,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; - immBegin(GL_LINES, efa->len * 2); + immBegin(PRIM_LINES, efa->len * 2); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { sel = uvedit_edge_select_test(scene, l, cd_loop_uv_offset); @@ -915,7 +915,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE); glPointSize(pointsize); - immBeginAtMost(GL_POINTS, bm->totface); + immBeginAtMost(PRIM_POINTS, bm->totface); /* unselected faces */ @@ -976,7 +976,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE); glPointSize(pointsize); - immBeginAtMost(GL_POINTS, bm->totloop); + immBeginAtMost(PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -996,7 +996,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe glPointSize(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0)); imm_cpack(0xFF); - immBeginAtMost(GL_POINTS, bm->totloop); + immBeginAtMost(PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) @@ -1016,7 +1016,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe immUniformThemeColor(TH_VERTEX_SELECT); glPointSize(pointsize); - immBeginAtMost(GL_POINTS, bm->totloop); + immBeginAtMost(PRIM_POINTS, bm->totloop); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index 1d9b58bfaa5..52829c6956b 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -213,7 +213,7 @@ void imm_draw_checker_box(float x1, float y1, float x2, float y2) void imm_draw_cylinder_fill_normal_3d( unsigned int pos, unsigned int nor, float base, float top, float height, int slices, int stacks) { - immBegin(GL_TRIANGLES, 6 * slices * stacks); + immBegin(PRIM_TRIANGLES, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { const float angle1 = 2 * M_PI * ((float)i / (float)slices); const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); @@ -264,7 +264,7 @@ void imm_draw_cylinder_fill_normal_3d( void imm_draw_cylinder_wire_3d(unsigned int pos, float base, float top, float height, int slices, int stacks) { - immBegin(GL_LINES, 6 * slices * stacks); + immBegin(PRIM_LINES, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { const float angle1 = 2 * M_PI * ((float)i / (float)slices); const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); @@ -301,7 +301,7 @@ void imm_draw_cylinder_wire_3d(unsigned int pos, float base, float top, float he void imm_draw_cylinder_fill_3d(unsigned int pos, float base, float top, float height, int slices, int stacks) { - immBegin(GL_TRIANGLES, 6 * slices * stacks); + immBegin(PRIM_TRIANGLES, 6 * slices * stacks); for (int i = 0; i < slices; ++i) { const float angle1 = 2 * M_PI * ((float)i / (float)slices); const float angle2 = 2 * M_PI * ((float)(i + 1) / (float)slices); diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index 3aea6f8bea4..ab29e91905b 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -259,7 +259,7 @@ static void draw_ofs_to_screen(GPUViewport *viewport) immUniform1i("image", 0); /* default GL_TEXTURE0 unit */ - immBegin(GL_TRIANGLE_STRIP, 4); + immBegin(PRIM_TRIANGLE_STRIP, 4); immAttrib2f(texcoord, 0.0f, 0.0f); immVertex2f(pos, 0.0f, 0.0f); @@ -392,7 +392,7 @@ void GPU_viewport_debug_depth_draw(GPUViewport *viewport, const float znear, con immUniform1f("zfar", zfar); immUniform1i("image", 0); /* default GL_TEXTURE0 unit */ - immBegin(GL_TRIANGLE_STRIP, 4); + immBegin(PRIM_TRIANGLE_STRIP, 4); immAttrib2f(texcoord, 0.0f, 0.0f); immVertex2f(pos, 0.0f, 0.0f); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b4922570687..d32e615d564 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3215,14 +3215,14 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd /* draw original angle line */ gpuRotate2D(RAD2DEGF(rc->initial_value)); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f); immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); immEnd(); /* draw new angle line */ gpuRotate2D(RAD2DEGF(rc->current_value - rc->initial_value)); - immBegin(GL_LINES, 2); + immBegin(PRIM_LINES, 2); immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE, 0.0f); immVertex2f(pos, (float)WM_RADIAL_CONTROL_DISPLAY_SIZE, 0.0f); immEnd(); diff --git a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c index 05fa0d78c4f..8775b373748 100644 --- a/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c +++ b/source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c @@ -109,7 +109,7 @@ static void arrow_draw_geom(const ArrowManipulator *arrow, const bool select, co if (arrow->style & MANIPULATOR_ARROW_STYLE_CROSS) { immUniformColor4fv(color); - immBegin(GL_LINES, 4); + immBegin(PRIM_LINES, 4); immVertex2f(pos, -1.0, 0.f); immVertex2f(pos, 1.0, 0.f); immVertex2f(pos, 0.f, -1.0); |