Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Picard <dam.pic@free.fr>2021-05-26 01:04:48 +0300
committerDamien Picard <dam.pic@free.fr>2021-05-26 01:38:06 +0300
commitaf94627460560da0f5fd03a7bb8897228d0b4c56 (patch)
tree514d4996ca4dfc477f03befc45896094072be779 /sun_position
parentbe0c6b3d9ed1430218e289f1813b8d0a5be93175 (diff)
Sun position: replace deprecated bgl module by gpu T80730
Diffstat (limited to 'sun_position')
-rw-r--r--sun_position/__init__.py4
-rw-r--r--sun_position/hdr.py8
-rw-r--r--sun_position/north.py4
3 files changed, 5 insertions, 11 deletions
diff --git a/sun_position/__init__.py b/sun_position/__init__.py
index 0b15602b..e59a0932 100644
--- a/sun_position/__init__.py
+++ b/sun_position/__init__.py
@@ -34,8 +34,8 @@
bl_info = {
"name": "Sun Position",
"author": "Michael Martin",
- "version": (3, 1, 1),
- "blender": (2, 80, 0),
+ "version": (3, 1, 2),
+ "blender": (3, 0, 0),
"location": "World > Sun Position",
"description": "Show sun position with objects and/or sky texture",
"doc_url": "{BLENDER_MANUAL_URL}/addons/lighting/sun_position.html",
diff --git a/sun_position/hdr.py b/sun_position/hdr.py
index 27d6dca2..6bbd0042 100644
--- a/sun_position/hdr.py
+++ b/sun_position/hdr.py
@@ -20,7 +20,6 @@
import bpy
import gpu
-import bgl
from gpu_extras.batch import batch_for_shader
from mathutils import Vector
from math import sqrt, pi, atan2, asin
@@ -60,6 +59,7 @@ def draw_callback_px(self, context):
nt = context.scene.world.node_tree.nodes
env_tex_node = nt.get(context.scene.sun_pos_properties.hdr_texture)
image = env_tex_node.image
+ texture = gpu.texture.from_image(image)
if self.area != context.area:
return
@@ -82,16 +82,12 @@ def draw_callback_px(self, context):
{"pos" : coords,
"texCoord" : uv_coords})
- bgl.glActiveTexture(bgl.GL_TEXTURE0)
- bgl.glBindTexture(bgl.GL_TEXTURE_2D, image.bindcode)
-
-
with gpu.matrix.push_pop():
gpu.matrix.translate(position)
gpu.matrix.scale(scale)
shader.bind()
- shader.uniform_int("image", 0)
+ shader.uniform_sampler("image", texture)
shader.uniform_float("exposure", self.exposure)
batch.draw(shader)
diff --git a/sun_position/north.py b/sun_position/north.py
index 0dbe7e4e..0c0a41af 100644
--- a/sun_position/north.py
+++ b/sun_position/north.py
@@ -17,7 +17,6 @@
# ##### END GPL LICENSE BLOCK #####
import bpy
-import bgl
import math
import gpu
from gpu_extras.batch import batch_for_shader
@@ -94,10 +93,9 @@ else:
shader.uniform_float("u_ViewProjectionMatrix", matrix)
shader.uniform_float("u_Resolution", (bpy.context.region.width, bpy.context.region.height))
shader.uniform_float("u_Color", color)
- bgl.glLineWidth(2.0)
+ gpu.state.line_width_set(2.0)
batch.draw(shader)
-
_handle = None