Is there a way to programmatically get the capabilities of my GPU at runtime using Pyglet?
I am making a game and would like to enable anti-aliasing. On my desktop (w/ nVidia Quadro), this works just fine:
import pyglet
class MyWindow(pyglet.window.Window):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.batch = pyglet.graphics.Batch()
self.circle = pyglet.shapes.Circle(
self.width / 2, self.height / 2, 100,
batch=self.batch
)
def on_draw(self):
self.clear()
self.batch.draw()
if __name__ == '__main__':
config = pyglet.gl.Config(sample_buffers=1, samples=8)
game_window = MyWindow(width=480, height=360, config=config)
pyglet.app.run()
and I get a nice anti-aliased edge on the circle. However, on my laptop (w/ integrated Intel graphics) I just get a white screen that never updates. Setting config = None makes everything visible again. Because I would like the game to be theoretically playable on any system, I want to selectively disable anti-aliasing for any GPU that doesn't support it. Something like:
import pyglet
class MyWindow(pyglet.window.Window):
...
def GPUSupportsAntialiasing() -> bool:
# magical pyglet and/or OpenGL stuff
if __name__ == '__main__':
if GPUSupportsAntialiasing():
config = pyglet.gl.Config(sample_buffers=1, samples=8)
else:
config = None
game_window = MyWindow(width=480, height=360, config=config)
pyglet.app.run()
Is this possible within Pyglet or another Python graphics module?