diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-19 11:46:05 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-19 16:22:58 +0300 |
commit | 3f11be3f7de90517826cb114f648b06fc85b67d4 (patch) | |
tree | 3698f730600c6fe119df84c759376f5c2d4fc130 /source/blender/editors | |
parent | 288892bf08f380afdfe7f2f8f5b1ca2d2e037fe3 (diff) |
Get rid of glMatrixMode calls
With the explicit calls we don't need to worry about current state
outside of the GPU module now. In fact. we don't need to worry about
current matrix mode in core profile at all.
Legacy OpenGL now has some code which ensures current matrix mode
when using explicit calls to push/pop matrix.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw_legacy.c | 14 |
3 files changed, 1 insertions, 21 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 365ebfc17c4..75ccdece799 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1377,9 +1377,7 @@ void UI_block_draw(const bContext *C, uiBlock *block) ui_but_to_pixelrect(&rect, ar, block, NULL); /* pixel space for AA widgets */ - glMatrixMode(GL_PROJECTION); gpuPushProjectionMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPushMatrix(); gpuLoadIdentity(); @@ -1406,9 +1404,7 @@ void UI_block_draw(const bContext *C, uiBlock *block) } /* restore matrix */ - glMatrixMode(GL_PROJECTION); gpuPopProjectionMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPopMatrix(); if (multisample_enabled) diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 3b3a11f3269..a6550b32265 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3175,9 +3175,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b if (ibuf) { float x, y; - glMatrixMode(GL_PROJECTION); gpuPushProjectionMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPushMatrix(); /* somehow the offset has to be calculated inverse */ @@ -3263,9 +3261,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b } } - glMatrixMode(GL_PROJECTION); gpuPopProjectionMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPopMatrix(); } diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 0d59b9afb14..88ba8439980 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -754,9 +754,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glMatrixMode(GL_PROJECTION); gpuPushProjectionMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPushMatrix(); ED_region_pixelspace(ar); @@ -777,9 +775,7 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, immDrawPixelsTex(&state, x1 - centx, y1 - centy, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, ibuf->rect, zoomx, zoomy, col); - glMatrixMode(GL_PROJECTION); gpuPopProjectionMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPopMatrix(); glDisable(GL_BLEND); @@ -1822,10 +1818,8 @@ void ED_view3d_draw_offscreen( GPU_free_images_anim(); } - glMatrixMode(GL_PROJECTION); gpuPushProjectionMatrix(); gpuLoadIdentity(); - glMatrixMode(GL_MODELVIEW); gpuPushMatrix(); gpuLoadIdentity(); @@ -1886,9 +1880,7 @@ void ED_view3d_draw_offscreen( ar->winy = bwiny; ar->winrct = brect; - glMatrixMode(GL_PROJECTION); gpuPopMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPopMatrix(); UI_Theme_Restore(&theme_state); @@ -2532,10 +2524,8 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) bool render_border = ED_view3d_calc_render_border(scene, v3d, ar, &border_rect); bool clip_border = (render_border && !BLI_rcti_compare(&ar->drawrct, &border_rect)); - glMatrixMode(GL_PROJECTION); gpuPushProjectionMatrix(); - gpuLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gpuLoadIdentityProjectionMatrix(); gpuPushMatrix(); gpuLoadIdentity(); @@ -2564,9 +2554,7 @@ void view3d_main_region_draw_legacy(const bContext *C, ARegion *ar) view3d_main_region_draw_info(C, scene, ar, v3d, grid_unit, render_border); - glMatrixMode(GL_PROJECTION); gpuPopProjectionMatrix(); - glMatrixMode(GL_MODELVIEW); gpuPopMatrix(); v3d->flag |= V3D_INVALID_BACKBUF; |