How to draw a point in 3DView always in front


The Mathvis Addon used to draw pixels always in front (in blender 2.79). This is no longer the case in Blender 2.80 So i wanted to fix this, but i do not know how and where to define that.

here is the function that draws a point in the MathVis Addon:

COLOR_POINT = (1, 0, 1, 1)
def draw_points(points):
    batch = batch_from_points(points, "POINTS")
    single_color_shader.uniform_float("color", COLOR_POINT)

Any hint for how to define “draw always in front” is very welcome :slight_smile:

Make sure bgl is imported. Then in the draw callback add:




See more info here.

1 Like

As far as i can tell the usage of the bgl module is disallowed or at least deprecated in blender 2.80.
However your suggestions works :slight_smile:
I still need to be sure it is accepted (or what is the replacement for this in Blender 2.80)

There are no plans to remove bgl as quoted by brecht from this post.

Functions that simplified creation of geometry has been stripped away, yes.
Functions defined in the core profile will remain.


I have now fixed the MathVis Addon according to your suggestion :slight_smile:
Thanks for helping!


1 Like