diff options
Diffstat (limited to 'source/blender/editors')
25 files changed, 79 insertions, 89 deletions
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 1bf6a301a67..68116d982b8 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -2030,7 +2030,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch, ToolSettings *ts = scene->toolsettings; SK_Stroke *stk; - glClear(GL_DEPTH_BUFFER_BIT); + gpuClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); if (with_names) { diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 34e3931c814..2963504b71a 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -442,8 +442,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w w = (rect->xmax - rect->xmin); h = (rect->ymax - rect->ymin); /* prevent drawing outside widget area */ - glGetIntegerv(GL_SCISSOR_BOX, scissor); - glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h); + gpuGetSizeBox(GL_SCISSOR_BOX, scissor); + gpuScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h); #endif glEnable(GL_BLEND); @@ -456,7 +456,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w #if 0 // restore scissortest - glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); + gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]); #endif #endif @@ -637,7 +637,7 @@ static void draw_scope_end(rctf *rect, GLint *scissor) float scaler_x1, scaler_x2; /* restore scissortest */ - glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); + gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]); /* scale widget */ scaler_x1 = rect->xmin + (rect->xmax - rect->xmin) / 2 - SCOPE_RESIZE_PAD; @@ -747,8 +747,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) uiDrawBox(GL_TRIANGLE_FAN, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, histogram can draw outside of boundary */ - glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), + gpuGetSizeBox(GL_VIEWPORT, scissor); + gpuScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); @@ -830,8 +830,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), /* need scissor test, waveform can draw outside of boundary */ - glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), + gpuGetSizeBox(GL_VIEWPORT, scissor); + gpuScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); @@ -1069,8 +1069,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco uiDrawBox(GL_TRIANGLE_FAN, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, hvectorscope can draw outside of boundary */ - glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), + gpuGetSizeBox(GL_VIEWPORT, scissor); + gpuScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); @@ -1411,13 +1411,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect cuma = cumap->cm + cumap->cur; /* need scissor test, curve can draw outside of boundary */ - glGetIntegerv(GL_VIEWPORT, scissor); + gpuGetSizeBox(GL_VIEWPORT, scissor); scissor_new.xmin = ar->winrct.xmin + rect->xmin; scissor_new.ymin = ar->winrct.ymin + rect->ymin; scissor_new.xmax = ar->winrct.xmin + rect->xmax; scissor_new.ymax = ar->winrct.ymin + rect->ymax; BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new); - glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin); + gpuScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin); /* calculate offset and zoom */ zoomx = (rect->xmax - rect->xmin - 2.0f * but->aspect) / (cumap->curr.xmax - cumap->curr.xmin); @@ -1577,7 +1577,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect glPointSize(1.0f); /* restore scissortest */ - glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); + gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]); /* outline */ gpuCurrentColor3ubv((unsigned char *)wcol->outline); @@ -1602,8 +1602,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc glEnable(GL_BLEND); /* need scissor test, preview image can draw outside of boundary */ - glGetIntegerv(GL_VIEWPORT, scissor); - glScissor(ar->winrct.xmin + (rect.xmin - 1), + gpuGetSizeBox(GL_VIEWPORT, scissor); + gpuScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1)); @@ -1653,7 +1653,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc track_pos[1] = scopes->track_pos[1]; /* draw content of pattern area */ - glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]); + gpuScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]); if (width > 0 && height > 0) { drawibuf = scopes->track_preview; @@ -1669,7 +1669,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc /* draw cross for pizel position */ gpuTranslate(rect.xmin + track_pos[0], rect.ymin + track_pos[1], 0.f); - glScissor(ar->winrct.xmin + rect.xmin, + gpuScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, rect.xmax - rect.xmin, rect.ymax - rect.ymin); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index e926f011c1c..2fc3d9b7509 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2790,7 +2790,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED( /* store the box bg as gl clearcolor, to retrieve later when drawing semi-transparent rects * over the top to indicate disabled buttons */ /* XXX, this doesnt work right since the color applies to buttons outside the box too. */ - glClearColor(wcol->inner[0] / 255.0, wcol->inner[1] / 255.0, wcol->inner[2] / 255.0, 1.0); + gpuSetClearColor(wcol->inner[0] / 255.0, wcol->inner[1] / 255.0, wcol->inner[2] / 255.0, 1.0); copy_v3_v3_char(wcol->inner, old_col); } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index cf0d02f466e..0de1a475774 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1316,9 +1316,8 @@ void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned cha void UI_ThemeClearColor(int colorid) { float col[3]; - UI_GetThemeColor3fv(colorid, col); - glClearColor(col[0], col[1], col[2], 0.0); + gpuSetClearColorvf(col, 0.0); } void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis) diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 4c7095dfb99..da9c3b06f49 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -59,7 +59,7 @@ #include "GPU_colors.h" #include "GPU_primitives.h" - +#include REAL_GL_MODE #include "BLF_api.h" #include "UI_interface.h" @@ -485,7 +485,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) /* optional header info instead? */ if (ar->headerstr) { UI_ThemeClearColor(TH_HEADER); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_ThemeColor(TH_TEXT); BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX); @@ -1656,7 +1656,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * /* clear */ UI_ThemeClearColor((ar->type->regionid == RGN_TYPE_PREVIEW) ? TH_PREVIEW_BACK : TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); /* before setting the view */ if (vertical) { @@ -1739,7 +1739,7 @@ void ED_region_header(const bContext *C, ARegion *ar) /* clear */ UI_ThemeClearColor((ED_screen_area_active(C)) ? TH_HEADER : TH_HEADERDESEL); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ UI_view2d_view_ortho(&ar->v2d); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index fcfefc53b34..78b7eb6c8d2 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -514,7 +514,7 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo float rast_x = x + off_x * xzoom; float rast_y = y + off_y * yzoom; - GLfloat scissor[4]; + int scissor[4]; int draw_w, draw_h; /* Determine the smallest number of pixels we need to draw @@ -529,9 +529,9 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo * fails if we zoom in on one really huge pixel so that it * covers the entire screen). */ - glGetFloatv(GL_SCISSOR_BOX, scissor); - draw_w = MIN2(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom)); - draw_h = MIN2(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom)); + gpuGetSizeBox(GL_SCISSOR_BOX, scissor); + draw_w = MIN2(img_w - off_x, ceil(((float)scissor[2] - rast_x) / xzoom)); + draw_h = MIN2(img_h - off_y, ceil(((float)scissor[3] - rast_y) / yzoom)); if (draw_w > 0 && draw_h > 0) { /* Don't use safe RasterPos (slower) if we can avoid it. */ @@ -576,8 +576,8 @@ void glaDefine2DArea(rcti *screen_rect) int sc_w = screen_rect->xmax - screen_rect->xmin + 1; int sc_h = screen_rect->ymax - screen_rect->ymin + 1; - glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h); - glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h); + gpuViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h); + gpuScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h); /* The 0.375 magic number is to shift the matrix so that * both raster and vertex integer coordinates fall at pixel @@ -597,7 +597,7 @@ void glaDefine2DArea(rcti *screen_rect) #if 0 /* UNUSED */ struct gla2DDrawInfo { - int orig_vp[4], orig_sc[4]; + int orig_vp[4], /*orig_sc[4]; Unused*/ float orig_projmat[16], orig_viewmat[16]; rcti screen_rect; @@ -633,8 +633,7 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect) int sc_w, sc_h; float wo_w, wo_h; - glGetIntegerv(GL_VIEWPORT, (GLint *)di->orig_vp); - glGetIntegerv(GL_SCISSOR_BOX, (GLint *)di->orig_sc); + gpuGetSizeBox(GL_VIEWPORT, (GLint *)di->orig_vp); gpuGetMatrix(GL_PROJECTION_MATRIX, (GLfloat *)di->orig_projmat); gpuGetMatrix(GL_MODELVIEW_MATRIX, (GLfloat *)di->orig_viewmat); @@ -675,8 +674,8 @@ void gla2DDrawTranslatePtv(gla2DDrawInfo *di, float world[2], int screen_r[2]) void glaEnd2DDraw(gla2DDrawInfo *di) { - glViewport(di->orig_vp[0], di->orig_vp[1], di->orig_vp[2], di->orig_vp[3]); - glScissor(di->orig_vp[0], di->orig_vp[1], di->orig_vp[2], di->orig_vp[3]); + gpuViewport(di->orig_vp[0], di->orig_vp[1], di->orig_vp[2], di->orig_vp[3]); + gpuScissor(di->orig_vp[0], di->orig_vp[1], di->orig_vp[2], di->orig_vp[3]); gpuMatrixMode(GL_PROJECTION); gpuLoadMatrix(di->orig_projmat); gpuMatrixMode(GL_MODELVIEW); @@ -693,7 +692,7 @@ void bgl_get_mats(bglMats *mats) gpuGetMatrix(GL_MODELVIEW_MATRIX, mats->modelview); gpuGetMatrix(GL_PROJECTION_MATRIX, mats->projection); - glGetIntegerv(GL_VIEWPORT, (GLint *)mats->viewport); + gpuGetSizeBox(GL_VIEWPORT, (GLint *)mats->viewport); /* Very strange code here - it seems that certain bad values in the * modelview matrix can cause gluUnProject to give bad results. */ diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 2c00f1070a3..8bc1396e86e 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -220,7 +220,7 @@ static void imapaint_tri_weights(Object *ob, /* compute barycentric coordinates */ /* get the needed opengl matrices */ - glGetIntegerv(GL_VIEWPORT, view); + gpuGetSizeBox(GL_VIEWPORT, view); gpuGetMatrix(GL_MODELVIEW_MATRIX, (float *)model); gpuGetMatrix(GL_PROJECTION_MATRIX, (float *)proj); view[0] = view[1] = 0; diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 496cd3fadaa..08b8cad809d 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -176,7 +176,7 @@ static void action_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); @@ -236,7 +236,7 @@ static void action_channel_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 97dc50edd88..a75de7bc37f 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -206,7 +206,7 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) { /* clear */ UI_ThemeClearColor(ED_screen_area_active(C) ? TH_HEADER : TH_HEADERDESEL); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); /* set view2d view matrix for scrolling (without scrollers) */ UI_view2d_view_ortho(&ar->v2d); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 935d0db20fa..7f50ffbe33f 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1152,7 +1152,7 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); /* data... */ movieclip_main_area_set_view2d(C, ar); @@ -1213,7 +1213,7 @@ static void graph_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); @@ -1246,7 +1246,7 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); @@ -1307,7 +1307,7 @@ static void clip_channels_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index edff77b6c6f..71e67b93785 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -221,7 +221,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); /* worlks best with no view2d matrix set */ UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 92b86c5a057..6c67150f3a8 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -323,8 +323,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); - glClearColor(col[0], col[1], col[2], 0.0); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(col, 0.0); /* Allow dynamically sliders to be set, saves notifiers etc. */ if (layout && (layout->flag == FILE_LAYOUT_VER)) { @@ -520,8 +519,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar) float col[3]; /* clear */ UI_GetThemeColor3fv(TH_PANEL, col); - glClearColor(col[0], col[1], col[2], 0.0); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(col, 0.0); /* scrolling here is just annoying, disable it */ ar->v2d.cur.ymax = ar->v2d.cur.ymax - ar->v2d.cur.ymin; diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index aa2352340cd..530cef82be4 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -232,8 +232,7 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); - glClearColor(col[0], col[1], col[2], 0.0); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(col, 0.0); UI_view2d_view_ortho(v2d); @@ -325,8 +324,7 @@ static void graph_channel_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); - glClearColor(col[0], col[1], col[2], 0.0); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(col, 0.0); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index a5f8c0b29f1..dd106a579d9 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -807,8 +807,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); - glClearColor(col[0], col[1], col[2], 0.0); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(col, 0.0); /* put scene context variable in iuser */ sima->iuser.scene = scene; diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c index 536aeb3a11a..ea09abe22e1 100644 --- a/source/blender/editors/space_info/info_draw.c +++ b/source/blender/editors/space_info/info_draw.c @@ -146,8 +146,7 @@ static int report_textview_begin(TextViewContext *tvc) /* iterator */ tvc->iter = reports->list.last; - glClearColor(120.0 / 255.0, 120.0 / 255.0, 120.0 / 255.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClear(120.0 / 255.0, 120.0 / 255.0, 120.0 / 255.0, 1.0); #ifdef USE_INFO_NEWLINE tvc->iter_tmp = 0; diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index ad3ea8152f7..c91b88a4537 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -152,7 +152,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); /* quick way to avoid drawing if not bug enough */ if (ar->winy < 16) diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 882e45a35c2..7cdc779f9d7 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -248,7 +248,7 @@ static void logic_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 922e6aed412..3f375551065 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -229,7 +229,7 @@ static void nla_channel_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); @@ -274,7 +274,7 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 282d2dfffcf..c03b37ccbf1 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -1116,7 +1116,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) LinkData *linkdata; UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 8621d3c4342..76fd192ceba 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -241,7 +241,7 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar) /* clear */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); draw_outliner(C); diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index 0cd20c00757..29f8e80a281 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -147,7 +147,7 @@ static void script_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index ccad6ab1d80..eae22858536 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -853,8 +853,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq if (frame_ofs == 0) { UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col); - glClearColor(col[0], col[1], col[2], 0.0); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(col, 0.0); } /* without this colors can flicker from previous opengl state */ @@ -1212,10 +1211,9 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_GetThemeColor3fv(TH_BACK, col); if (ed && ed->metastack.first) - glClearColor(col[0], col[1], col[2] - 0.1f, 0.0f); + gpuColorAndClear(col[0], col[1], col[2] - 0.1f, 0.0f); else - glClearColor(col[0], col[1], col[2], 0.0f); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(col, 0.0f); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 474c5018420..aa98b10bdb6 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -479,7 +479,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); UI_view2d_view_ortho(v2d); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5672487b2b1..6a62c8ad1ee 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7572,7 +7572,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec gpuMultMatrix(ob->obmat); - glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT); + /*glClearDepth(1.0); */gpuClear(GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); switch (ob->type) { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a365a6bd41a..5500e3b03d2 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1389,15 +1389,15 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) glDisable(GL_MULTISAMPLE_ARB); region_scissor_winrct(ar, &winrct); - glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin); + gpuScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin); - glClearColor(0.0, 0.0, 0.0, 0.0); + gpuSetClearColor(0.0, 0.0, 0.0, 0.0); if (v3d->zbuf) { glEnable(GL_DEPTH_TEST); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } else { - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); glDisable(GL_DEPTH_TEST); } @@ -1885,7 +1885,7 @@ static void view3d_draw_xray(Scene *scene, ARegion *ar, View3D *v3d, int clear) View3DAfter *v3da, *next; if (clear && v3d->zbuf) - glClear(GL_DEPTH_BUFFER_BIT); + gpuClear(GL_DEPTH_BUFFER_BIT); v3d->xray = TRUE; for (v3da = v3d->afterdraw_xray.first; v3da; v3da = next) { @@ -1904,7 +1904,7 @@ static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, int c View3DAfter *v3da, *next; if (clear && v3d->zbuf) - glClear(GL_DEPTH_BUFFER_BIT); + gpuClear(GL_DEPTH_BUFFER_BIT); v3d->xray = TRUE; v3d->transp = TRUE; @@ -2188,7 +2188,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) invert_m4_m4(rv3d->persinv, rv3d->persmat); invert_m4_m4(rv3d->viewinv, rv3d->viewmat); - glClear(GL_DEPTH_BUFFER_BIT); + gpuClear(GL_DEPTH_BUFFER_BIT); gpuLoadMatrix(rv3d->viewmat); @@ -2223,7 +2223,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *)) invert_m4_m4(rv3d->persinv, rv3d->persmat); invert_m4_m4(rv3d->viewinv, rv3d->viewmat); - glClear(GL_DEPTH_BUFFER_BIT); + gpuClear(GL_DEPTH_BUFFER_BIT); gpuLoadMatrix(rv3d->viewmat); // persp(PERSP_STORE); /* store correct view for persp(PERSP_VIEW) calls */ @@ -2596,14 +2596,14 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr); else copy_v3_v3(backcol, &scene->world->horr); - glClearColor(backcol[0], backcol[1], backcol[2], 0.0); + gpuSetClearColorvf(backcol, 0.0); } else { UI_ThemeClearColor(TH_BACK); } - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* setup view matrices */ view3d_main_area_setup_view(scene, v3d, ar, viewmat, winmat); @@ -2907,15 +2907,15 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw cliprct.ymax = CLAMPIS(cliprct.ymax, ar->winrct.ymin, ar->winrct.ymax); if (cliprct.xmax > cliprct.xmin && cliprct.ymax > cliprct.ymin) { - glGetIntegerv(GL_SCISSOR_BOX, scissor); - glScissor(cliprct.xmin, cliprct.ymin, cliprct.xmax - cliprct.xmin, cliprct.ymax - cliprct.ymin); + gpuGetSizeBox(GL_SCISSOR_BOX, scissor); + gpuScissor(cliprct.xmin, cliprct.ymin, cliprct.xmax - cliprct.xmin, cliprct.ymax - cliprct.ymin); } else return 0; } - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuSetClearColor(0.0f, 0.0f, 0.0f, 0.0f); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (v3d->flag & V3D_DISPBGPICS) view3d_draw_bgpic(scene, ar, v3d, FALSE, TRUE); @@ -2931,7 +2931,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw if (draw_border) { /* restore scissor as it was before */ - glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); + gpuScissor(scissor[0], scissor[1], scissor[2], scissor[3]); } return 1; @@ -2971,12 +2971,12 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr); else copy_v3_v3(backcol, &scene->world->horr); - glClearColor(backcol[0], backcol[1], backcol[2], 0.0); + gpuSetClearColorvf(backcol, 0.0); } else UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* setup view matrices */ view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL); |