Python: Remove deprecated BGL API

The API was in a deprecation state for many years now.
This API was not compatible with Metal nor Vulkan.

This also remove `Image.bindcode`.

Pull Request: https://projects.blender.org/blender/blender/pulls/140370
This commit is contained in:
Clément Foucault
2025-06-16 12:50:50 +02:00
committed by Clément Foucault
parent 9ddc67166f
commit decd88f67e
26 changed files with 3 additions and 4499 deletions

View File

@@ -350,7 +350,7 @@ def banner(context):
"PYTHON INTERACTIVE CONSOLE {:s}".format(version_string),
"",
"Builtin Modules: "
"bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, gpu, blf, mathutils",
"bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, gpu, blf, mathutils",
"Convenience Imports: from mathutils import *; from math import *",
"Convenience Variables: C = bpy.context, D = bpy.data",

View File

@@ -89,14 +89,6 @@ def draw_texture_2d(texture, position, width, height):
gpu.matrix.scale((width, height))
shader = gpu.shader.from_builtin('IMAGE')
if isinstance(texture, int):
# Call the legacy bgl to not break the existing API
import bgl
bgl.glActiveTexture(bgl.GL_TEXTURE0)
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture)
shader.uniform_int("image", 0)
else:
shader.uniform_sampler("image", texture)
shader.uniform_sampler("image", texture)
batch.draw(shader)