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/platform.py | |
parent | c75fefeb134e4c99778eada20c89e2245e30b7f7 (diff) | |
download | txtgameengine-fd73d0ad2c3b54850baf3c467954c92bd40ed010.tar.gz txtgameengine-fd73d0ad2c3b54850baf3c467954c92bd40ed010.tar.bz2 txtgameengine-fd73d0ad2c3b54850baf3c467954c92bd40ed010.zip |
shader support
Diffstat (limited to 'txtgameengine/platform.py')
-rw-r--r-- | txtgameengine/platform.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/txtgameengine/platform.py b/txtgameengine/platform.py index 17d85ab..f4b3b5b 100644 --- a/txtgameengine/platform.py +++ b/txtgameengine/platform.py @@ -90,7 +90,7 @@ class ShaderComponent: self.app = app @staticmethod - def load_shaders(vertex_file, fragment_file): + def load_shaders(vertex_file: str, fragment_file: str): with open(vertex_file) as fp: vertex_source = fp.read() with open(fragment_file) as fp: @@ -101,8 +101,12 @@ class ShaderComponent: return shaders.compileProgram(vertex_shader, fragment_shader) @staticmethod - def get_uniform_location(shader, name): - return glGetUniformLocation(shader, name) + def bind_shader(prog_id: int): + glUseProgram(prog_id) + + @staticmethod + def get_uniform_location(prog_id: int, name: str): + return glGetUniformLocation(prog_id, name) class RenderComponent: |