diff options
author | rom <romangraef@gmail.com> | 2021-04-24 00:36:05 +0200 |
---|---|---|
committer | rom <romangraef@gmail.com> | 2021-04-24 00:36:05 +0200 |
commit | fd73d0ad2c3b54850baf3c467954c92bd40ed010 (patch) | |
tree | ed1be11f8aacaf86d9de747ee2ba8170907cabf8 /txtgameengine/__main__.py | |
parent | c75fefeb134e4c99778eada20c89e2245e30b7f7 (diff) | |
download | txtgameengine-fd73d0ad2c3b54850baf3c467954c92bd40ed010.tar.gz txtgameengine-fd73d0ad2c3b54850baf3c467954c92bd40ed010.tar.bz2 txtgameengine-fd73d0ad2c3b54850baf3c467954c92bd40ed010.zip |
shader support
Diffstat (limited to 'txtgameengine/__main__.py')
-rw-r--r-- | txtgameengine/__main__.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/txtgameengine/__main__.py b/txtgameengine/__main__.py index 1ebc309..9aeeec3 100644 --- a/txtgameengine/__main__.py +++ b/txtgameengine/__main__.py @@ -2,8 +2,8 @@ import numpy as np from PIL import Image from .scenes import SceneTxtGameApp, Scene -from OpenGL.GL import * from pathlib import Path +from .shaders import TextureShader shader_path = Path(__file__).parent / 'builtin_shaders' @@ -46,9 +46,7 @@ class EvilTriangleScene(TriangleScene): class TextureScene(Scene): def on_enter(self): - self.texture_shaders = self.app.shaders.load_shaders(str(shader_path / 'texture/vertex.glsl'), - str(shader_path / 'texture/fragment.glsl')) - self.sampler_location = self.app.shaders.get_uniform_location(self.texture_shaders, 'textureSampler') + self.texture_shaders = TextureShader(self.app) self.texture = self.app.render.setup_texture_from_pil(Image.open('test_image.png')) self.triangle = self.app.render.setup_buffer( np.array([ @@ -65,7 +63,8 @@ class TextureScene(Scene): def update(self, delta: float): with self.texture_shaders: - self.app.render.textured_triangle(self.sampler_location, self.texture, self.triangle, self.uvs) + self.app.render.textured_triangle(self.texture_shaders.textureSampler, self.texture, self.triangle, + self.uvs) class TestApp(SceneTxtGameApp): |