Last active
March 21, 2020 12:17
-
-
Save aoirint/36fe6cb4135d64214a1d223cdb483206 to your computer and use it in GitHub Desktop.
GLFW Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from OpenGL.GL import * | |
| import glfw | |
| import numpy as np | |
| glfw.init() | |
| window = glfw.create_window(640, 480, 'My Window', None, None) | |
| glfw.make_context_current(window) | |
| # These parameters need to be changed according to your environment. | |
| # Mac: https://support.apple.com/ja-jp/HT202823 | |
| glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 4) | |
| glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 1) | |
| glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) | |
| glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) | |
| print('Vendor :', glGetString(GL_VENDOR)) | |
| print('GPU :', glGetString(GL_RENDERER)) | |
| print('OpenGL version :', glGetString(GL_VERSION)) | |
| while not glfw.window_should_close(window): | |
| glClearColor(0, 0, 0, 1) | |
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) | |
| # ... OpenGL Codes ... | |
| glfw.swap_buffers(window) | |
| glfw.poll_events() | |
| glfw.destroy_window(window) | |
| glfw.terminate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment