summaryrefslogtreecommitdiff
path: root/txtgameengine/__main__.py
diff options
context:
space:
mode:
authorrgraef <romangraef@gmail.com>2021-04-22 13:26:56 +0200
committerrgraef <romangraef@gmail.com>2021-04-22 13:26:56 +0200
commit2b597ca9617fd424d0785afae15b9f7adc78ef70 (patch)
tree74bf5a12d86517641c95e1c720649be35102635f /txtgameengine/__main__.py
parenta165c0da2484776124bf895a810076c8acf94368 (diff)
downloadtxtgameengine-2b597ca9617fd424d0785afae15b9f7adc78ef70.tar.gz
txtgameengine-2b597ca9617fd424d0785afae15b9f7adc78ef70.tar.bz2
txtgameengine-2b597ca9617fd424d0785afae15b9f7adc78ef70.zip
working triangles
Diffstat (limited to 'txtgameengine/__main__.py')
-rw-r--r--txtgameengine/__main__.py37
1 files changed, 17 insertions, 20 deletions
diff --git a/txtgameengine/__main__.py b/txtgameengine/__main__.py
index bed2972..84d71ca 100644
--- a/txtgameengine/__main__.py
+++ b/txtgameengine/__main__.py
@@ -1,34 +1,31 @@
-import glfw
-from glfw.GLFW import *
+import numpy as np
from .app import TxtGameApp
-
-
-def main():
- glfw.init()
- glfw.window_hint(GLFW_CLIENT_API, GLFW_NO_API)
- window = glfw.create_window(640, 480, "Vulkan window", None, None)
- if not window:
- glfw.terminate()
- return
- glfw.swap_interval(1)
- while not glfw.window_should_close(window):
- glfw.swap_buffers(window)
- glfw.poll_events()
- glfw.destroy_window(window)
- glfw.terminate()
+from OpenGL.GL import *
class TestApp(TxtGameApp):
def __init__(self):
- super().__init__((640, 480), "Vulkan window")
- self.requested_validation_layers += ["VK_LAYER_KHRONOS_validation"]
+ super().__init__((640, 480), "OpenGL window")
+
+ def init(self):
+ self.render.setup_vertex_arrays()
+ #self.platform.check_debug()
+ self.default_shaders = self.shaders.load_shaders(
+ 'base_shaders/vertex.glsl', 'base_shaders/fragment.glsl')
+ self.tri_buffer = self.render.setup_triangle(np.array([
+ -1.0, -1.0, 0.0,
+ 1.0, -1.0, 0.0,
+ 0.0, 1.0, 0.0,
+ ], np.float32))
def update(self, delta: float):
super().update(delta)
+ with self.default_shaders:
+ self.render.triangle(self.tri_buffer)
+
if __name__ == '__main__':
- # main()
a = TestApp()
a.start()