diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-01-16 06:59:42 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-01-16 07:51:29 +0300 |
commit | 2d71d13ea2cb7a7640e5139dc24341bd58416d57 (patch) | |
tree | 48061a6f98f4212de685e3dc8279270a5427e898 /source/blender/editors/uvedit | |
parent | 31375a1b21a98f5ce6abdd46a41a1e287d3d5050 (diff) |
OpenGL: fixes related to GL_POINTS
I put all usage of GL_POINTS under the microscope. Fixed problems &
optimized a couple of spots.
- reduce calls to glPointSize by about 50%
- draw selected & unselected vertices together for UV editor & EditMesh
- draw initial gpencil stroke point the proper size
- a few other smaller fixes
New policy: each GL_POINTS draw call needs to set its desired point
size. This eliminates half our calls to glPointSize (setting it back to
its 1.0 default after every draw).
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 10 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 7 |
2 files changed, 6 insertions, 11 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 9f9a42e9b80..988f60a36f9 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -856,12 +856,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) float cent[2]; pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE); - glPointSize(pointsize); // TODO - drawobject.c changes this value after - Investigate! + glPointSize(pointsize); + glBegin(GL_POINTS); + /* unselected faces */ UI_ThemeColor(TH_WIRE); - glBegin(GL_POINTS); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; @@ -871,12 +872,10 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) glVertex2fv(cent); } } - glEnd(); /* selected faces */ UI_ThemeColor(TH_FACE_DOT); - glBegin(GL_POINTS); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_TAG)) continue; @@ -886,6 +885,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) glVertex2fv(cent); } } + glEnd(); } @@ -947,8 +947,6 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) } glEnd(); } - - glPointSize(1.0); } diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 828537fd585..c9f4d274b8e 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1506,15 +1506,12 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) { int i, index = 0; - float pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE); StitchState *state = (StitchState *)arg; StitchPreviewer *stitch_preview = state->stitch_preview; glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); glEnableClientState(GL_VERTEX_ARRAY); - glPointSize(pointsize * 2.0f); - glEnable(GL_BLEND); UI_ThemeColor4(TH_STITCH_PREVIEW_ACTIVE); @@ -1542,6 +1539,8 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar /* draw vert preview */ if (state->mode == STITCH_VERT) { + glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f); + UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE); glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_stitchable); glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable); @@ -1562,8 +1561,6 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar glPopClientAttrib(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - glPointSize(1.0); } static UvEdge *uv_edge_get(BMLoop *l, StitchState *state) |