summaryrefslogtreecommitdiff
path: root/renderer.py
diff options
context:
space:
mode:
Diffstat (limited to 'renderer.py')
-rw-r--r--renderer.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/renderer.py b/renderer.py
index ae4be12..3d157cb 100644
--- a/renderer.py
+++ b/renderer.py
@@ -36,7 +36,8 @@ class ImageRenderer:
@staticmethod
def _init_shader():
vertex_src = """
- #version 330 core
+ #version 300 es
+ precision mediump float; // Precision for float variables (mandatory for ES)
layout (location = 0) in vec2 aPos; // Vertex position
layout (location = 1) in vec2 aTexCoord; // Texture coordinates
uniform mat4 uTransform; // Transformation matrix
@@ -48,7 +49,8 @@ class ImageRenderer:
}
"""
fragment_src = """
- #version 330 core
+ #version 300 es
+ precision mediump float; // Precision for float variables (mandatory for ES)
in vec2 TexCoord; // Interpolated texture coordinates
out vec4 FragColor; // Final fragment color
uniform sampler2D uTexture; // Texture sampler
@@ -96,6 +98,8 @@ class ImageRenderer:
return vao
def draw_image(self, tex, win_w, win_h, alpha):
+ if not tex.initialized:
+ return
glUseProgram(self.shader)
glBindVertexArray(self.vao)
# FIXME check if tex.id is None