-
Notifications
You must be signed in to change notification settings - Fork 1
/
01_checking.py
39 lines (27 loc) · 924 Bytes
/
01_checking.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
from OpenGL.GL import *
def main():
# Initialize the library
if not glfw.init():
raise Exception('glfw can\'t be initialized')
# Create a windowed mode window and its OpenGL context
window = glfw.create_window(640, 480, "Hello World", None, None)
if not window:
glfw.terminate()
raise Exception('glfw window can\'t be created')
# Make the window's context current
glfw.make_context_current(window)
# Coloring window
glClearColor(0, 0, 0.1, 0)
# Loop until the user closes the window
while not glfw.window_should_close(window):
# Render here, e.g. using pyOpenGL
# Swap front and back buffers
glfw.swap_buffers(window)
# Clear Buffer color
glClear(GL_COLOR_BUFFER_BIT)
# Poll for and process events
glfw.poll_events()
glfw.terminate()
if __name__ == "__main__":
main()