Suggestions / feedback on the extensions for the gpu module

This topic is intended for add-on developers who want to port their code to use the gpu module.

As discussed in BGL deprecation, the bgl module is at the end of its days and should be removed to give free way to a switchable drawing API in Blender (Vulkan + OpenGL).

To this end, patches are being proposed to extend the gpu API and make it possible for the bgl API to be replaced:

Feel free to comment on the patches, suggest changes and ask questions about how to replace the bgl module.

The documentation is updated automatically:

This topic will be updated as soon as new patches are proposed.


Please, add ability to draw clickable(selectable) text to bpy.types.Gizmo draw method

Could we have a way to render depth buffer into a texture with GPU python modules? Now we can render the 3D View into a texture with “offscreen.draw_view3d” and “offscreen.color_texture”. Could we have something like “offscreen.depth_texture”?

I find in Blender 2.92 glReadPixels will always produce 0.0 for bgl.GL_DEPTH_COMPONENT, while it works well with bgl.GL_RGBA. Making the depth buffer of 3DViewport accessible really helps a lot when adding some effects. Thanks a million!

In fact “offscreen.color_texture” needs to be updated (and “offscreen.depth_texture” will be a good addition).
Currently “offscreen.color_texture” returns a bind value for OpenGL. So it must be deprecated.


Just want to chime in and say +1 to being able to access the depth buffer. Also, is there any indication yet as to what will replace this after the current implementation is deprecated?

We have the GPUFramebufer.read_color, so we could have a GPUFramebufer.read_depth.
But only if it is really necessary to port the current addons as it can limit the vulkan’s implementation.