-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
39 lines (29 loc) · 814 Bytes
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import glfw
import OpenGL
import time
from OpenGL.GL import *
def main():
demo = Demo()
demo.run()
class Demo:
windowID = None
def run(this):
this.init()
while not glfw.window_should_close(this.windowID):
this.update()
this.render()
def init(this):
if not glfw.init():
return
this.windowID = glfw.create_window(640, 480, "Test", None, None)
glfw.show_window(this.windowID)
glfw.make_context_current(this.windowID)
glfw.swap_interval(1)
glClearColor(0, 0, 0, 1);
def update(this):
glfw.poll_events()
def render(this):
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glfw.swap_buffers(this.windowID)
if __name__ == '__main__':
main()