Different drawing for object centers.

Code here did depth test always and depth range 0.0.

There is no real reason for object centers to write and get tested
against depth buffer in this case, just disable the depth test instead
;)

Helps with blurry object centers in depth of field mode too (centers
wrote depth 0 and were always blurry)
This commit is contained in:
Antonis Ryakiotakis 2015-05-04 13:53:07 +02:00
parent be30070d86
commit 5a8629c0d7
Notes: blender-bot 2023-02-14 10:48:33 +01:00
Referenced by commit e10ecb6494, Revert "Different drawing for object centers."
1 changed files with 2 additions and 7 deletions

View File

@ -735,11 +735,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
const float size = ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f;
float verts[CIRCLE_RESOL][3];
/* using gldepthfunc guarantees that it does write z values,
* but not checks for it, so centers remain visible independent order of drawing */
if (v3d->zbuf) glDepthFunc(GL_ALWAYS);
/* write to near buffer always */
glDepthRange(0.0, 0.0);
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
if (special_color) {
@ -769,10 +765,9 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
/* finish up */
glDisableClientState(GL_VERTEX_ARRAY);
glDepthRange(0.0, 1.0);
glDisable(GL_BLEND);
if (v3d->zbuf) glDepthFunc(GL_LEQUAL);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
}
/* *********** text drawing for object/particles/armature ************* */