diff options
author | Ray Molenkamp <github@lazydodo.com> | 2018-06-28 04:07:23 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2018-06-28 04:07:23 +0300 |
commit | 8e02106d0ddc7b31844d26037a824d56d3c65663 (patch) | |
tree | bfa1898220d74ac9610b8a1363a4087a44f7b41d /source/blender/editors/space_view3d/drawobject.c | |
parent | fe258fd4451a7fb1ccdd85d1607b6dbd30442f28 (diff) |
GLRefactor: partially remove gl calls from source/blender/editors.
This translates the gl calls to the new GPU_ wrappers from D3501.
Given it's tedious and repetitive work, this patch does as much as it can with search + replace, the remainder of the gl calls will need to be manually dealt with on a case by case basis.
This fixes 13 of the 28 failing editors when building without opengl.
For the list of substitutions see D3502
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3502
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 1224c284d5f..5ecef03e475 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -100,6 +100,8 @@ #include "GPU_immediate_util.h" #include "GPU_batch.h" #include "GPU_matrix.h" +#include "GPU_state.h" +#include "GPU_framebuffer.h" #include "ED_mesh.h" #include "ED_particle.h" @@ -289,7 +291,7 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); + GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); immBeginAtMost(GWN_PRIM_POINTS, imm_len); dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); @@ -332,7 +334,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); + GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); immBeginAtMost(GWN_PRIM_POINTS, em->bm->totvert); dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); @@ -343,7 +345,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) #else static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) { - glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); + GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE)); Mesh *me = em->ob->data; Gwn_Batch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset); @@ -384,7 +386,7 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset) immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - glLineWidth(1.0f); + GPU_line_width(1.0f); immBeginAtMost(GWN_PRIM_LINES, imm_len); dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data); @@ -395,7 +397,7 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset) #else static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset) { - glLineWidth(1.0f); + GPU_line_width(1.0f); Mesh *me = em->ob->data; Gwn_Batch *batch = DRW_mesh_batch_cache_get_edges_with_select_id(me, offset); @@ -503,7 +505,7 @@ static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm) immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32); - glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); + GPU_point_size(UI_GetThemeValuef(TH_FACEDOT_SIZE)); immBeginAtMost(GWN_PRIM_POINTS, em->bm->totface); dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP); @@ -621,8 +623,8 @@ void draw_object_backbufsel( gpuMultMatrix(ob->obmat); - glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); + glClearDepth(1.0); GPU_clear(GPU_DEPTH_BIT); + GPU_depth_test(true); switch (ob->type) { case OB_MESH: @@ -722,7 +724,7 @@ void ED_draw_object_facemap( glColor4fv(col); gpuPushAttrib(GL_ENABLE_BIT); - glEnable(GL_BLEND); + GPU_blend(true); glDisable(GL_LIGHTING); /* always draw using backface culling */ @@ -752,8 +754,8 @@ void ED_draw_object_facemap( immUniformColor4fv(col); /* XXX, alpha isn't working yet, not sure why. */ - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); + GPU_blend(true); MVert *mvert; @@ -810,7 +812,7 @@ void ED_draw_object_facemap( immUnbindProgram(); - glDisable(GL_BLEND); + GPU_blend(false); } #endif |