How to deal with openGL deprecation?

So, sadly most used functions on bgl got removed. I was trying to find examples or tutorials about how to use modern opengl api. but couldnt find anything that use only functions that will be avaliable on 2.8.

Please Help.

I have a simple funcion that draw a line on 3D space and would like to have it working on 2.8:

def draw_line(start, end, color=(1.0, 1.0, 1.0, 1.0), width=1.0):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(width)
    bgl.glColor4f(*color)
    bgl.glBegin(bgl.GL_LINES)
    
    bgl.glVertex3f(*start)
    bgl.glVertex3f(*end)
    
    bgl.glEnd()
    bgl.glDisable(bgl.GL_BLEND)

If so. @brecht, I would like to suggest a simple module like Gizmos from unity api. You have no Idea of how this is usefull to debug scripts that deal with vectors.

Most recent OpenGL tutorials and documentation will cover this, for example:
https://learnopengl.com/

It’s not Blender specific really. But you probably want to wait until there is an easier drawing API.

1 Like