| 1 |
"""In order to use the features of modern OpenGL versions, you must ask for |
| 2 |
a specific context version. You can do this by supplying the `major_version` |
| 3 |
and `minor_version` attributes for a GL Config. |
| 4 |
|
| 5 |
This example creates an OpenGL 4.2 context, prints the version string to stdout, |
| 6 |
and exits. Note that some GPU drivers may return a newer version than requested, |
| 7 |
at their discretion. |
| 8 |
""" |
| 9 |
import pyglet |
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
config = pyglet.gl.Config(major_version=4, minor_version=2) |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
window = pyglet.window.Window(config=config, visible=False) |
| 22 |
|
| 23 |
|
| 24 |
print('OpenGL version:', window.context.get_info().get_version()) |
| 25 |
|
| 26 |
window.close() |