pixel
pixel copied to clipboard
Handling high DPI
Is there a way to handle screens with high DPI, for example Retina on MacBooks?
When I developed with the C++ engine Urho3D it was possible to set HighDPI = false. Is there a way to achieve this with Pixel?
(I see lower FPS when running on retina, so it would be nice if it could be configured)
I believe it is the responsibility of the OpenGL program to manually account for this; that's why every game has a resolution option.
You should be able to reduce the DPI by just downsizing the canvas and then setting the window transformation matrix to scale it back up. The platformer example does just that if I recall correctly.
There's nothing actually special about "high DPI". It just means a higher resolution and/or a smaller screen.
If you're looking to achieve better framerates on higher resolutions, you can utilise downscaling as @20zinnm suggests, among many other tricks.
If you're looking to achieve similarly sized graphics across multiple DPIs, i.e., you want your character to be about an inch high, you'll need to know the DPI of the screen upon which you're being displayed, then do some maths to pick the right art assets, scale them to the correct size, move them at the correct speed, etc.
It seems GLFW 3.3 includes a function to help with this: https://www.glfw.org/docs/3.3/window_guide.html#window_scale
@faiface 3.3 seems to be fairly stable, how much longer are we going to wait for it to come out of beta on go/glfw (#137).
Sorry for not responding earlier. This issue has been discussed but no definitive solution has been found yet.
The thing is, that when the user creates a 800x600px window, he may rely on the fact the window is 800x600px and we if someone doesn't want to handle HDPI, we don't want to break his program.
The HighDPI = false
setting sounds interesting. What does it exactly do?
P.S. I love you Gopher game @Lallassu :)
@Lallassu I'm not sure I understand this issue. Could you reiterate?
As @Asday said, doesn't HDPI just mean a higher resolution display? What is different in this case?