diff options
author | Alexander Romanov <a.romanov@blend4web.com> | 2016-05-16 11:13:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-09 22:38:17 +0300 |
commit | 6798809c7ec8388509f541a64359b3d107e6fd3f (patch) | |
tree | cab8d4b80cfca2974814af7598248edd6368b6e5 /source/blender/editors/interface | |
parent | d733826708f9b562687b78424e5c0835cba8c3c9 (diff) |
Flat shading for basic shader
The purpose of the patch is to replace deprecated glShadeModel.
To decrease glShadeModel calls I've set GL_SMOOTH by default
Reviewers: merwin, brecht
Reviewed By: brecht
Subscribers: blueprintrandom, Evgeny_Rodygin, AlexKowel, yurikovelenov
Differential Revision: https://developer.blender.org/D1958
Diffstat (limited to 'source/blender/editors/interface')
4 files changed, 5 insertions, 32 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 8fbc545cb77..d78b41820b4 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -181,7 +181,6 @@ void UI_draw_roundbox_shade_x( coldown[1] = max_ff(0.0f, color[1] + shadedown); coldown[2] = max_ff(0.0f, color[2] + shadedown); - glShadeModel(GL_SMOOTH); glBegin(mode); /* start with corner right-bottom */ @@ -260,7 +259,6 @@ void UI_draw_roundbox_shade_x( } glEnd(); - glShadeModel(GL_FLAT); } /* linear vertical shade within button or in outline */ @@ -291,7 +289,6 @@ void UI_draw_roundbox_shade_y( colRight[1] = max_ff(0.0f, color[1] + shadeRight); colRight[2] = max_ff(0.0f, color[2] + shadeRight); - glShadeModel(GL_SMOOTH); glBegin(mode); /* start with corner right-bottom */ @@ -367,7 +364,6 @@ void UI_draw_roundbox_shade_y( } glEnd(); - glShadeModel(GL_FLAT); } /* plain antialiased unfilled rectangle */ @@ -531,7 +527,6 @@ static void histogram_draw_one( } else { /* under the curve */ - glShadeModel(GL_FLAT); glBegin(GL_TRIANGLE_STRIP); glVertex2f(x, y); glVertex2f(x, y + (data[0] * h)); @@ -1087,7 +1082,6 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); /* layer: color ramp */ - glShadeModel(GL_FLAT); glEnable(GL_BLEND); CBData *cbd = coba->data; @@ -1133,7 +1127,6 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti glEnd(); glDisable(GL_BLEND); - glShadeModel(GL_SMOOTH); /* layer: box outline */ glColor4f(0.0, 0.0, 0.0, 1.0); @@ -1212,9 +1205,9 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) qobj = gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); - glShadeModel(GL_SMOOTH); + int bound_options = GPU_basic_shader_bound_options(); + GPU_basic_shader_bind(bound_options); gluSphere(qobj, 100.0, 32, 24); - glShadeModel(GL_FLAT); gluDeleteQuadric(qobj); glEndList(); @@ -1677,7 +1670,6 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) { glEnable(GL_BLEND); - glShadeModel(GL_SMOOTH); glBegin(GL_QUADS); @@ -1689,7 +1681,6 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, glEnd(); glDisable(GL_BLEND); - glShadeModel(GL_FLAT); } diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 222b0366791..6dc60f1d70b 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -368,7 +368,6 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), viconutil_set_point(pts[1], cx - d2, cy - d); viconutil_set_point(pts[2], cx + d2, cy); - glShadeModel(GL_SMOOTH); glBegin(GL_TRIANGLES); glColor4f(0.8f, 0.8f, 0.8f, alpha); glVertex2iv(pts[0]); @@ -376,7 +375,6 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), glColor4f(0.3f, 0.3f, 0.3f, alpha); glVertex2iv(pts[2]); glEnd(); - glShadeModel(GL_FLAT); glColor4f(0.0f, 0.0f, 0.0f, 1); viconutil_draw_lineloop_smooth(pts, 3); @@ -395,13 +393,11 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float glColor4f(0.2f, 0.2f, 0.2f, alpha); - glShadeModel(GL_SMOOTH); glBegin(GL_TRIANGLES); glVertex2iv(pts[0]); glVertex2iv(pts[1]); glVertex2iv(pts[2]); glEnd(); - glShadeModel(GL_FLAT); } static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha) @@ -415,7 +411,6 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), f viconutil_set_point(pts[1], cx - d, cy + d2); viconutil_set_point(pts[2], cx, cy - d2); - glShadeModel(GL_SMOOTH); glBegin(GL_TRIANGLES); glColor4f(0.8f, 0.8f, 0.8f, alpha); glVertex2iv(pts[0]); @@ -423,7 +418,6 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), f glColor4f(0.3f, 0.3f, 0.3f, alpha); glVertex2iv(pts[2]); glEnd(); - glShadeModel(GL_FLAT); glColor4f(0.0f, 0.0f, 0.0f, 1); viconutil_draw_lineloop_smooth(pts, 3); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 62b373c58c8..85e32144bcd 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1763,12 +1763,10 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px, tab_curve_radius, roundboxtype, true, true, NULL); /* tab highlight (3d look) */ - glShadeModel(GL_SMOOTH); glColor3ubv(is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive); ui_panel_category_draw_tab(GL_LINE_STRIP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, - tab_curve_radius, roundboxtype, true, false, - is_active ? theme_col_back : theme_col_tab_inactive); - glShadeModel(GL_FLAT); + tab_curve_radius, roundboxtype, true, false, + is_active ? theme_col_back : theme_col_tab_inactive); } /* tab blackline */ diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 19e0b55374e..5098e701638 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -712,8 +712,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) unsigned char *col_pt = col_array; shadecolors4(col1, col2, wcol->inner, wcol->shadetop, wcol->shadedown); - - glShadeModel(GL_SMOOTH); + for (a = 0; a < wtb->totvert; a++, col_pt += 4) { round_box_shade_col4_r(col_pt, col1, col2, wtb->inner_uv[a][wtb->draw_shadedir ? 1 : 0]); } @@ -725,8 +724,6 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) glDrawArrays(GL_POLYGON, 0, wtb->totvert); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); - - glShadeModel(GL_FLAT); } } @@ -2311,8 +2308,6 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * ui_color_picker_to_rgb(0.0f, 0.0f, hsv[2], colcent, colcent + 1, colcent + 2); - glShadeModel(GL_SMOOTH); - glBegin(GL_TRIANGLE_FAN); glColor3fv(colcent); glVertex2f(centx, centy); @@ -2330,8 +2325,6 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti * } glEnd(); - glShadeModel(GL_FLAT); - /* fully rounded outline */ glPushMatrix(); glTranslatef(centx, centy, 0.0f); @@ -2363,7 +2356,6 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons float col1[4][3]; /* right half, rect bottom to top */ /* draw series of gouraud rects */ - glShadeModel(GL_SMOOTH); switch (type) { case UI_GRAD_SV: @@ -2486,8 +2478,6 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons } glEnd(); } - - glShadeModel(GL_FLAT); } bool ui_but_is_colorpicker_display_space(uiBut *but) |