Search code examples
pythonopenglretina-displaypyglethighdpi

HighDPI retina windows in pyglet


Is there a way to create a retina window in pyglet?

The default pyglet.window.Window() creates a window that is blurry on my retina screen. Is there a setting in pyglet or do I have to dive into the Open GL plumbing to do this?


Solution

  • It seems that pyglet 1.3 is not aware of Retina displays. Despite of what pyglet window doc says, the window.get_size() method returns points instead of pixels. That's an issue coming from the way Apple has designed High Resolution stuff.

    Apple info:

    Likely you can't use the setWantsBestResolutionOpenGLSurface parameter.

    So your best bet is doubling the sizes to be used at glViewport. And following this path, also double the sizes (2x*2y = 4*x*y) of FBO buffers, textures, and positions.