|
1 | 1 | import glfw |
2 | | -import moderngl |
| 2 | +import sys |
3 | 3 |
|
4 | | -from OpenGL import GL |
| 4 | +import moderngl as mgl |
5 | 5 |
|
6 | 6 | from demosys.conf import settings |
7 | 7 | from demosys.core.exceptions import ImproperlyConfigured |
@@ -40,11 +40,11 @@ def __init__(self): |
40 | 40 |
|
41 | 41 | glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) |
42 | 42 | if settings.OPENGL.get('forward_compat'): |
43 | | - glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, GL.GL_TRUE) |
| 43 | + glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) |
44 | 44 | if not settings.WINDOW.get('resizable'): |
45 | | - glfw.window_hint(glfw.RESIZABLE, GL.GL_FALSE) |
| 45 | + glfw.window_hint(glfw.RESIZABLE, False) |
46 | 46 |
|
47 | | - glfw.window_hint(glfw.DOUBLEBUFFER, GL.GL_TRUE) |
| 47 | + glfw.window_hint(glfw.DOUBLEBUFFER, True) |
48 | 48 |
|
49 | 49 | # glfw.window_hint(glfw.RED_BITS, 8) |
50 | 50 | # glfw.window_hint(glfw.GREEN_BITS, 8) |
@@ -92,15 +92,22 @@ def __init__(self): |
92 | 92 | print("Actual window size:", glfw.get_window_size(self.window)) |
93 | 93 |
|
94 | 94 | glfw.make_context_current(self.window) |
95 | | - print("Context Version:", GL.glGetString(GL.GL_VERSION).decode()) |
96 | 95 |
|
97 | 96 | # The number of screen updates to wait from the time glfwSwapBuffers |
98 | 97 | # was called before swapping the buffers and returning |
99 | 98 | if settings.WINDOW.get('vsync'): |
100 | 99 | glfw.swap_interval(1) |
101 | 100 |
|
102 | 101 | # Create mederngl context from existing context |
103 | | - self.ctx = moderngl.create_context() |
| 102 | + self.ctx = mgl.create_context() |
| 103 | + print("Context Version:") |
| 104 | + print('ModernGL:', mgl.__version__) |
| 105 | + print('vendor:', self.ctx.info['GL_VENDOR']) |
| 106 | + print('renderer:', self.ctx.info['GL_RENDERER']) |
| 107 | + print('version:', self.ctx.info['GL_VERSION']) |
| 108 | + print('python:', sys.version) |
| 109 | + print('platform:', sys.platform) |
| 110 | + print('code:', self.ctx.version_code) |
104 | 111 |
|
105 | 112 | def should_close(self): |
106 | 113 | return glfw.window_should_close(self.window) |
|
0 commit comments