diff options
Diffstat (limited to 'source')
41 files changed, 121 insertions, 150 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); diff --git a/source/blender/gpu/GPU_compatibility.h b/source/blender/gpu/GPU_compatibility.h index 752b90bbfd5..0e48cb0bf83 100644 --- a/source/blender/gpu/GPU_compatibility.h +++ b/source/blender/gpu/GPU_compatibility.h @@ -36,6 +36,7 @@ #include "intern/gpu_immediate_inline.h" #include "intern/gpu_lighting_inline.h" +#include "intern/gpu_view.h" #include "GPU_matrix.h" diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 83f1343e26a..63b7d76db88 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1042,6 +1042,8 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap) } } +#include REAL_GL_MODE + void GPU_update_images_framechange(void) { Image *ima; @@ -1254,6 +1256,7 @@ static struct GPUMaterialState { GLfloat lastalphatestref; } GMS = {NULL}; + static void disable_blend(void) { if (GMS.lastblendenabled) { @@ -1284,12 +1287,14 @@ static void enable_blendfunc_add(void) { enable_blend(); - if (!GMS.lastblendfuncdefault) { + if (GMS.lastblendfuncdefault) { glBlendFunc(GL_ONE, GL_ONE); /* non-standard blend function */ GMS.lastblendfuncdefault = GL_FALSE; } } +#include FAKE_GL_MODE + static void disable_alphatest(void) { if (GMS.lastalphatestenabled) { @@ -1337,6 +1342,7 @@ static void reset_default_alphablend_state(void) if (!GMS.lastblendfuncdefault) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* reset blender default */ + GMS.lastblendfuncdefault = GL_TRUE; } if (GMS.lastalphatestref != 0.5f) { diff --git a/source/blender/gpu/intern/gpu_matrix.c b/source/blender/gpu/intern/gpu_matrix.c index 60548f0c206..fde896fa7e7 100644 --- a/source/blender/gpu/intern/gpu_matrix.c +++ b/source/blender/gpu/intern/gpu_matrix.c @@ -262,7 +262,6 @@ if(curglslesi) glUniformMatrix4fv(curglslesi->projectionmatloc, 1, 0, ms_projection.dynstack[ms_projection.pos]); } -#include FAKE_GL_MODE } diff --git a/source/blender/gpu/intern/gpu_view.c b/source/blender/gpu/intern/gpu_view.c index e998a27d990..8eee8244ebc 100644 --- a/source/blender/gpu/intern/gpu_view.c +++ b/source/blender/gpu/intern/gpu_view.c @@ -43,7 +43,7 @@ gpuSetClearColorvf = gpuSetClearColorvf_gl; gpuViewport = gpuViewport_gl; gpuScissor = gpuScissor_gl; gpuViewportScissor = gpuViewportScissor_gl; -gpuGetScissorBox = gpuGetScissorBox_gl; +gpuGetSizeBox = gpuGetSizeBox_gl; gpuClear = gpuClear_gl; diff --git a/source/blender/gpu/intern/gpu_view.h b/source/blender/gpu/intern/gpu_view.h index b90f4988c20..7fd2046d34f 100644 --- a/source/blender/gpu/intern/gpu_view.h +++ b/source/blender/gpu/intern/gpu_view.h @@ -53,7 +53,7 @@ GPU_VIEW_FUNC void (* gpuViewport)(int x, int y, unsigned int width, unsigned in GPU_VIEW_FUNC void (* gpuScissor)(int x, int y, unsigned int width, unsigned int height); GPU_VIEW_FUNC void (* gpuViewportScissor)(int x, int y, unsigned int width, unsigned int height); -GPU_VIEW_FUNC void (*gpuGetScissorBox)(int *box); +GPU_VIEW_FUNC void (*gpuGetSizeBox)(int type, int *box); #ifdef __cplusplus } diff --git a/source/blender/gpu/intern/gpu_view_gl.c b/source/blender/gpu/intern/gpu_view_gl.c index 8346a98e06e..9a29528a629 100644 --- a/source/blender/gpu/intern/gpu_view_gl.c +++ b/source/blender/gpu/intern/gpu_view_gl.c @@ -72,9 +72,9 @@ glEnable(GL_SCISSOR_TEST); //gpuSetClearColor_gl((float)rand()/RAND_MAX,(float)rand()/RAND_MAX,(float)rand()/RAND_MAX,0); } -void gpuGetScissorBox_gl(int *box) +void gpuGetSizeBox_gl(int type, int *box) { - glGetIntegerv(GL_SCISSOR_BOX, box); + glGetIntegerv(type, box); } void gpuViewportScissor_gl(int x, int y, unsigned int width, unsigned int height) diff --git a/source/blender/gpu/intern/gpu_view_gl.h b/source/blender/gpu/intern/gpu_view_gl.h index c82b03bd823..4cc2105ee0e 100644 --- a/source/blender/gpu/intern/gpu_view_gl.h +++ b/source/blender/gpu/intern/gpu_view_gl.h @@ -40,6 +40,6 @@ void gpuScissor_gl(int x, int y, unsigned int width, unsigned int height); void gpuViewportScissor_gl(int x, int y, unsigned int width, unsigned int height); -void gpuGetScissorBox_gl(int *box); +void gpuGetSizeBox_gl(int type, int *box); void gpuClear_gl(int mask); diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 048017db4b1..5584731903c 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -573,8 +573,8 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) int copytex = 0, paintcursor = 1; if (win->drawdata) { - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuSetClearColor(0, 0, 0, 0); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); wmSubWindowSet(win, screen->mainwin); diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 8ce96020b98..3f4a7159cb6 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -32,7 +32,6 @@ * \ingroup wm */ - #include <string.h> #include "MEM_guardedalloc.h" @@ -263,7 +262,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct) width = _curswin->winrct.xmax - _curswin->winrct.xmin + 1; height = _curswin->winrct.ymax - _curswin->winrct.ymin + 1; - glViewport(x, y, width, height); + gpuViewport(x, y, width, height); if (srct) { x = srct->xmin; @@ -272,7 +271,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct) height = srct->ymax - srct->ymin + 1; } - glScissor(x, y, width, height); + gpuScissor(x, y, width, height); wmOrtho2(-0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 96db16d1282..1e98a576f47 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -369,10 +369,10 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state"); /* until screens get drawn, make it nice gray */ - glClearColor(0.55, 0.55, 0.55, 0.0); + gpuSetClearColor(0.55, 0.55, 0.55, 0.0); /* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */ if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { - glClear(GL_COLOR_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT); } wm_window_swap_buffers(win); diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index d9540cd0c57..fae5afe0179 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -151,10 +151,9 @@ int BL_KetsjiNextFrame(class KX_KetsjiEngine* ketsjiengine, struct bContext *C, // Clear screen to border color // We do this here since we set the canvas to be within the frames. This means the engine // itself is unaware of the extra space, so we clear the whole region for it. - glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f); - glViewport(ar->winrct.xmin, ar->winrct.ymin, + gpuViewport(ar->winrct.xmin, ar->winrct.ymin, ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin); - glClear(GL_COLOR_BUFFER_BIT); + gpuColorAndClearvf(scene->gm.framing.col, 1.0f);; } // render the frame diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index e5553798afa..28694baebe6 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -45,7 +45,7 @@ m_frame_rect(rect) m_area_left = ar->winrct.xmin; m_area_top = ar->winrct.ymax; - glGetIntegerv(GL_VIEWPORT, (GLint*)m_viewport); + gpuGetSizeBox(GL_VIEWPORT, (GLint*)m_viewport); } KX_BlenderCanvas::~KX_BlenderCanvas() @@ -89,11 +89,10 @@ void KX_BlenderCanvas::EndFrame() void KX_BlenderCanvas::ClearColor(float r,float g,float b,float a) { - glClearColor(r,g,b,a); + gpuSetClearColor(r,g,b,a); } - void KX_BlenderCanvas::ClearBuffer(int type) { int ogltype = 0; @@ -103,7 +102,7 @@ void KX_BlenderCanvas::ClearBuffer(int type) if (type & RAS_ICanvas::DEPTH_BUFFER ) ogltype |= GL_DEPTH_BUFFER_BIT; - glClear(ogltype); + gpuClear(ogltype); } int KX_BlenderCanvas::GetWidth( @@ -167,14 +166,12 @@ SetViewPort( m_area_rect.SetBottom(miny + y1); m_area_rect.SetRight(minx + x2); m_area_rect.SetTop(miny + y2); - m_viewport[0] = minx+x1; m_viewport[1] = miny+y1; m_viewport[2] = vp_width; m_viewport[3] = vp_height; - glViewport(minx + x1, miny + y1, vp_width, vp_height); - glScissor(minx + x1, miny + y1, vp_width, vp_height); + gpuViewportScissor(minx + x1, miny + y1, vp_width, vp_height); } const int* diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp index 9650325fc4d..cbc9248c05a 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp @@ -58,10 +58,6 @@ unsigned int KX_BlenderRenderTools::m_numgllights; KX_BlenderRenderTools::KX_BlenderRenderTools() { -#include REAL_GL_MODE -//glClearColor(1.0f,1.0f,1.0f,0.0f); -//glClear(GL_COLOR_BUFFER_BIT); -#include FAKE_GL_MODE printf("Done\n"); glGetIntegerv(GL_MAX_LIGHTS, (GLint*) &m_numgllights); if (m_numgllights < 8) diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp index d2ff6c99285..91427998128 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp @@ -29,10 +29,6 @@ * \ingroup player */ -#ifdef GLES -#include <GLES2/gl2.h> -#endif - #ifndef NOPNG #ifdef WIN32 #include "png.h" @@ -64,7 +60,7 @@ GPC_Canvas::GPC_Canvas( m_displayarea.m_x2 = width; m_displayarea.m_y2 = height; - glGetIntegerv(GL_VIEWPORT, (GLint*)m_viewport); + gpuGetSizeBox(GL_VIEWPORT, (GLint*)m_viewport); } @@ -76,7 +72,7 @@ GPC_Canvas::~GPC_Canvas() // void GPC_Canvas::InitPostRenderingContext(void) // { -// glViewport(0, 0, m_width, m_height); +// gpuViewport(0, 0, m_width, m_height); // gpuMatrixMode(GL_PROJECTION); // gpuLoadIdentity(); @@ -113,9 +109,7 @@ void GPC_Canvas::EndFrame() void GPC_Canvas::ClearColor(float r, float g, float b, float a) { -#include REAL_GL_MODE - ::glClearColor(r,g,b,a); -#include FAKE_GL_MODE + ::gpuSetClearColor(r,g,b,a); } void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2) @@ -130,7 +124,6 @@ void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2) * but where... definitely need to clean up this * whole canvas/rendertools mess. */ -#include REAL_GL_MODE glEnable(GL_SCISSOR_TEST); m_viewport[0] = x1; @@ -138,9 +131,7 @@ void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2) m_viewport[2] = x2-x1 + 1; m_viewport[3] = y2-y1 + 1; - glViewport(x1,y1,x2-x1 + 1,y2-y1 + 1); - glScissor(x1,y1,x2-x1 + 1,y2-y1 + 1); -#include FAKE_GL_MODE + gpuViewportScissor(x1,y1,x2-x1 + 1,y2-y1 + 1); }; const int *GPC_Canvas::GetViewPort() @@ -157,9 +148,7 @@ void GPC_Canvas::ClearBuffer( ogltype |= GL_COLOR_BUFFER_BIT; if (type & RAS_ICanvas::DEPTH_BUFFER ) ogltype |= GL_DEPTH_BUFFER_BIT; -#include REAL_GL_MODE - ::glClear(ogltype); -#include FAKE_GL_MODE + ::gpuClear(ogltype); } @@ -403,8 +392,7 @@ GPC_Canvas:: SetOrthoProjection( ) { // Set up OpenGL matrices - ::glViewport(0, 0, m_width, m_height); - ::glScissor(0, 0, m_width, m_height); + ::gpuViewportScissor(0, 0, m_width, m_height); ::gpuMatrixMode(GL_TEXTURE); ::gpuLoadIdentity(); diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index ea8621dfdaf..209b26e7e75 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -1538,8 +1538,7 @@ void KX_Dome::Draw(void) if (fboSupported) { glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, warp.fboId); - glViewport(0,0,warp.imagesize, warp.imagesize); - glScissor(0,0,warp.imagesize, warp.imagesize); + gpuViewportScissor(0,0,warp.imagesize, warp.imagesize); } switch(m_mode) { @@ -1578,7 +1577,7 @@ void KX_Dome::Draw(void) void KX_Dome::DrawEnvMap(void) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gpuMatrixMode(GL_PROJECTION); gpuLoadIdentity(); @@ -1711,7 +1710,7 @@ void KX_Dome::DrawEnvMap(void) void KX_Dome::DrawDomeFisheye(void) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gpuMatrixMode(GL_PROJECTION); gpuLoadIdentity(); gpuMatrixCommit(); @@ -1803,7 +1802,7 @@ void KX_Dome::DrawDomeFisheye(void) void KX_Dome::DrawPanorama(void) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gpuMatrixMode(GL_PROJECTION); gpuLoadIdentity(); @@ -1884,7 +1883,7 @@ void KX_Dome::DrawPanorama(void) void KX_Dome::DrawDomeWarped(void) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gpuMatrixMode(GL_PROJECTION); // Making the viewport always square diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index b4815b72a38..06e235bd38e 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -33,9 +33,6 @@ #include <math.h> #include <stdlib.h> -#ifdef GLES -#include "GLES2/gl2.h" -#endif #include "RAS_OpenGLRasterizer.h" @@ -170,9 +167,9 @@ bool RAS_OpenGLRasterizer::Init() m_blueback = 0.4375; m_alphaback = 0.0; - glClearColor(m_redback,m_greenback,m_blueback,m_alphaback); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuSetClearColor(m_redback,m_greenback,m_blueback,m_alphaback); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glShadeModel(GL_SMOOTH); @@ -304,14 +301,14 @@ void RAS_OpenGLRasterizer::Exit() #include REAL_GL_MODE glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); -#include FAKE_GL_MODE - glClearDepth(1.0); + /*glClearDepth(1.0); */ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glClearColor(m_redback, m_greenback, m_blueback, m_alphaback); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + gpuSetClearColor(m_redback, m_greenback, m_blueback, m_alphaback); + gpuClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDepthMask (GL_TRUE); glDepthFunc(GL_LEQUAL); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* reset blender default */ +#include FAKE_GL_MODE glAlphaFunc(GL_GREATER, 0.5f); /* reset blender default */ glDisable(GL_POLYGON_STIPPLE); |