Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-01-16 06:59:42 +0300
committerMike Erwin <significant.bit@gmail.com>2016-01-16 07:51:29 +0300
commit2d71d13ea2cb7a7640e5139dc24341bd58416d57 (patch)
tree48061a6f98f4212de685e3dc8279270a5427e898 /source/blender/editors/space_view3d
parent31375a1b21a98f5ce6abdd46a41a1e287d3d5050 (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/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c3
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c10
-rw-r--r--source/blender/editors/space_view3d/drawobject.c37
-rw-r--r--source/blender/editors/space_view3d/drawsimdebug.c2
4 files changed, 17 insertions, 35 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index d753ad68fcc..9872b05da63 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -220,7 +220,6 @@ void draw_motion_path_instance(Scene *scene,
glVertex3fv(mpv->co);
glEnd();
- glPointSize(1.0f);
UI_ThemeColor(TH_TEXT_HI);
}
@@ -305,8 +304,6 @@ void draw_motion_path_instance(Scene *scene,
}
glEnd();
- glPointSize(1.0f);
-
/* Draw frame numbers of keyframes */
if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) {
float co[3];
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index e35c70048e7..6a3e8f242be 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1000,6 +1000,12 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
/* this chunk not in object mode */
if (armflag & (ARM_EDITMODE | ARM_POSEMODE)) {
glLineWidth(4.0f);
+ if (G.f & G_PICKSEL) {
+ /* no bitmap in selection mode, crashes 3d cards...
+ * instead draw a solid point the same size */
+ glPointSize(8.0f);
+ }
+
if (armflag & ARM_POSEMODE)
set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
else if (armflag & ARM_EDITMODE) {
@@ -1008,7 +1014,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
/* Draw root point if we are not connected */
if ((boneflag & BONE_CONNECTED) == 0) {
- if (G.f & G_PICKSEL) { /* no bitmap in selection mode, crashes 3d cards... */
+ if (G.f & G_PICKSEL) {
GPU_select_load_id(id | BONESEL_ROOT);
glBegin(GL_POINTS);
glVertex3f(0.0f, 0.0f, 0.0f);
@@ -2587,7 +2593,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
/* ********************************** Armature Drawing - Main ************************* */
-/* called from drawobject.c, return 1 if nothing was drawn
+/* called from drawobject.c, return true if nothing was drawn
* (ob_wire_col == NULL) when drawing ghost */
bool draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
const short dt, const short dflag, const unsigned char ob_wire_col[4],
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index de79468d144..5b95c047036 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -135,7 +135,6 @@ typedef struct drawDMVerts_userData {
unsigned char th_vertex_select[4];
unsigned char th_vertex[4];
unsigned char th_skin_root[4];
- float th_vertex_size;
/* for skin node drawing */
int cd_vskin_offset;
@@ -972,7 +971,6 @@ static void drawshadbuflimits(Lamp *la, float mat[4][4])
glVertex3fv(sta);
glVertex3fv(end);
glEnd();
- glPointSize(1.0);
}
static void spotvolume(float lvec[3], float vvec[3], const float inp)
@@ -1501,7 +1499,6 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
glBegin(GL_POINTS);
glVertex3fv(vec);
glEnd();
- glPointSize(1.0);
glDisable(GL_BLEND);
@@ -1529,7 +1526,6 @@ static void draw_limit_line(float sta, float end, const short dflag, const unsig
glVertex3f(0.0, 0.0, -sta);
glVertex3f(0.0, 0.0, -end);
glEnd();
- glPointSize(1.0);
}
}
@@ -2234,7 +2230,6 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, BPoint *actbp, short s
}
glEnd();
- glPointSize(1.0);
}
static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, int actdef_wcol)
@@ -2567,20 +2562,13 @@ static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3],
}
}
- /* draw active larger - need to stop/start point drawing for this :/ */
+ /* draw active in a different color - no need to stop/start point drawing for this :D */
if (eve == data->eve_act) {
glColor4ubv(data->th_editmesh_active);
-
- glEnd();
-
- glPointSize(data->th_vertex_size);
- glBegin(GL_POINTS);
glVertex3fv(co);
- glEnd();
+ /* back to regular vertex color */
glColor4ubv(data->sel ? data->th_vertex_select : data->th_vertex);
- glPointSize(data->th_vertex_size);
- glBegin(GL_POINTS);
}
else {
glVertex3fv(co);
@@ -2601,7 +2589,6 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer
UI_GetThemeColor4ubv(TH_VERTEX_SELECT, data.th_vertex_select);
UI_GetThemeColor4ubv(TH_VERTEX, data.th_vertex);
UI_GetThemeColor4ubv(TH_SKIN_ROOT, data.th_skin_root);
- data.th_vertex_size = UI_GetThemeValuef(TH_VERTEX_SIZE);
/* For skin root drawing */
data.cd_vskin_offset = CustomData_get_offset(&em->bm->vdata, CD_MVERT_SKIN);
@@ -2609,6 +2596,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer
mul_m4_m4m4(data.imat, rv3d->viewmat, em->ob->obmat);
invert_m4(data.imat);
+ glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
glBegin(GL_POINTS);
dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data, DM_FOREACH_NOP);
glEnd();
@@ -3182,7 +3170,6 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
}
if (v3d->zbuf) glDepthMask(1);
- glPointSize(1.0);
}
static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
@@ -3995,7 +3982,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
{
glPointSize(1.5);
dm->drawVerts(dm);
- glPointSize(1.0);
}
else if ((dt == OB_WIRE) || no_faces) {
draw_wire = OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff */
@@ -4196,8 +4182,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
drawSelectedVertices(dm, ob->data);
if (!use_depth) glEnable(GL_DEPTH_TEST);
else ED_view3d_polygon_offset(rv3d, 0.0);
-
- glPointSize(1.0f);
}
dm->release(dm);
}
@@ -5846,7 +5830,6 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
glShadeModel(GL_FLAT);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
glLineWidth(1.0f);
- glPointSize(1.0f);
}
static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, float ith, float drw_size)
@@ -6161,7 +6144,6 @@ static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, const
}
glEnd();
- glPointSize(1.0);
}
static void editnurb_draw_active_poly(Nurb *nu)
@@ -7268,7 +7250,6 @@ static void draw_hooks(Object *ob)
glBegin(GL_POINTS);
glVertex3fv(vec);
glEnd();
- glPointSize(1.0);
}
}
}
@@ -7859,7 +7840,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
glEnd();
- glPointSize(1.0);
glMultMatrixf(ob->obmat);
glDisable(GL_BLEND);
@@ -8047,9 +8027,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
if (do_draw_center != -1) {
if (dflag & DRAW_PICKING) {
/* draw a single point for opengl selection */
- glBegin(GL_POINTS);
- glVertex3fv(ob->obmat[3]);
- glEnd();
+ if (U.obcenter_dia > 0) {
+ glPointSize(U.obcenter_dia);
+ glBegin(GL_POINTS);
+ glVertex3fv(ob->obmat[3]);
+ glEnd();
+ }
}
else if ((dflag & DRAW_CONSTCOLOR) == 0) {
/* we don't draw centers for duplicators and sets */
@@ -8200,7 +8183,6 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
glBegin(GL_POINTS);
dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
glEnd();
- glPointSize(1.0);
}
static void bbs_mesh_verts__mapFunc(void *userData, int index, const float co[3],
@@ -8221,7 +8203,6 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
glBegin(GL_POINTS);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
glEnd();
- glPointSize(1.0);
}
static DMDrawOption bbs_mesh_wire__setDrawOptions(void *userData, int index)
diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c
index 46320ba6763..91adc905816 100644
--- a/source/blender/editors/space_view3d/drawsimdebug.c
+++ b/source/blender/editors/space_view3d/drawsimdebug.c
@@ -62,7 +62,6 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
glVertex3f(elem->v1[0], elem->v1[1], elem->v1[2]);
}
glEnd();
- glPointSize(1.0f);
/**** circles ****/
@@ -123,7 +122,6 @@ static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
glVertex3f(elem->v1[0], elem->v1[1], elem->v1[2]);
}
glEnd();
- glPointSize(1.0f);
glBegin(GL_LINES);
for (BLI_ghashIterator_init(&iter, debug_data->gh); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {