Drawing colored and semi transparent text into the viewport

Hello everyone!

I’m trying to make a simple addon in 2.80 that draws text on the viewport using the blf module, and while text is drawn, I can’t figure out how to give it transparency and color (other than pure white).
blf.color doesn’t seem to work and from the examples online, I understand that in the past you’d use the bgl module along with bgl.glColor4f() but that also doesn’t seem to work anymore since from what I understand, many functions were removed from it.

removed
Is this done through the new ‘gpu’ module? If so, how do I go about doing it?
I’m new to Python and the Blender API in general so please excuse me if I’m missing something obvious or going about doing this the wrong way.

Thanks!

Short reply since I’m on my phone, but you have to arrange your draw calls into batches first and bind them to a shader rather than the old ancient gl.begin vetex lists. Pull up the 2.80 beta python docs and read up on all of the bgl changes, it was one of the big overhauls in 2.8

https://docs.blender.org/api/blender2.8/gpu.html

1 Like