Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arbitrary zoom / custom resolution support #10382

pchote opened this issue Jan 2, 2016 · 8 comments


Copy link

@pchote pchote commented Jan 2, 2016

This outlines my plan for fixing our issues relating to zoom, custom resolutions, and HiDPI support in one fell swoop. I've referred to it several times in the past, so I figure it is time to document this properly. From my perspective this supersedes all the previous tickets, but of course others are free to argue against this.

User interface

Two new dropdowns are included in the display settings: UI resolution and World resolution (like UT3 and i'm sure other games have done). They contain values for "Native", a selection of popular defaults with a fixed width and a height calculated from the aspect ratio, and a "custom" option that exposes text fields for entering a manual width. These set the (fixed) size of the UI, and the default size/zoom of the world.

Players can use ctrl + scroll to arbitrarily zoom the world (but not the UI) between the minimum and maximum limits (explained below). The . key (currently used for pixel doubling) is used to reset the world to the default zoom configured in the settings.


The world rendering (everything that scales with the world, so this excludes selection decorations, target lines, etc) is rendered into a framebuffer that is configured a viewport size calculated from the zoom and default resolution, and the result is rendered using a quad covering the window viewport. The UI rendering (everything else from the world, and then the widgets) is similarly rendered first into a framebuffer (maybe the same as the first, depending on the cost of reconfiguring a buffer vs switching to a new one), and then scaled to fill the screen.

The default "Native" value is calculated by the window / display size divided by the native pixel scale (queried from SDL). The pixel scale will be 2 for retina displays under OSX, or between 0.75 and 2 (I think?) for the different DPI options under Windows. We can calculate the pixel scale by comparing the resolution that we asked for with the output from SDL_GetRendererOutputSize. The minimum supported resolution is defined in mod.yaml (with defaults for our mods of 1024 x 700), and the maximum values are queried from the GPU (the smaller of GL_MAX_RENDERBUFFER_SIZE / GL_MAX_TEXTURE_SIZE).

To enable HiDPI rendering we need to set SDL_WINDOW_ALLOW_HIGHDPI when creating the window, and under OSX we also need to set NSHighResolutionCapable in Info.plist. I have no idea how DPI scaling works across the various linux WMs or whether they are supported by SDL.

The world is always rendered with a "zoom" of 1 into the framebuffer, so all of the fiddly code using Viewport.Zoom can be removed (yay!). The shader-level hack for rendering the depth buffer can also be removed in favour of rendering the depth texture from the framebuffer.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@pchote pchote added Feature UI labels Jan 2, 2016

This comment has been minimized.

Copy link

@Phrohdoh Phrohdoh commented Jan 14, 2016

I'm be willing to spend a chunk of time on this if I could get mentored, but if that is going to cause more trouble than someone else doing it outright there is no point to guide me through it.


This comment has been minimized.

Copy link
Member Author

@pchote pchote commented Aug 7, 2016

SDL 2.0.4 added which gives us a much cleaner way for determining the default scaling factor.


This comment has been minimized.

Copy link

@samrocketman samrocketman commented Dec 14, 2016

I'm considering playing this in WINE because it isn't natively playable in 4k resolution (3840x2160). WINE has a DPI setting which I can double (from 96dpi to 192dpi) and use WINE apps normally.

The biggest issue for me is I can't see the text and graphics without having my nose an inch off the screen.

  • OS: Ubuntu 16.04.1 LTS GNU/Linux

This comment has been minimized.

Copy link
Member Author

@pchote pchote commented Dec 24, 2016

@samrocketman: #12501 adds an OPENRA_DISPLAY_SCALE environment variable that you can use to bump up the size.


This comment has been minimized.

Copy link

@Skeeve Skeeve commented Jun 21, 2017

This is not yet implemented, is it?

I always use my Mac's Zoom feature which is an annoyance when your mouse accidently hits the screen's borders.


This comment has been minimized.

Copy link

@hadow hadow commented Mar 13, 2018

This is not yet implemented,are you ok?


This comment has been minimized.

Copy link

@mytbk mytbk commented Apr 3, 2019

I've tried OPENRA_DISPLAY_SCALE and it looks good. However, after I use it, it also scale the map and the units, just like double pixeling. When I don't scale, I can see a whole small map without scrolling in a 4k display, so what I want is not scaling the map, and just scale the menu and minimap on the right.


This comment has been minimized.

Copy link

@HunterZ HunterZ commented Apr 15, 2019

New user impression using release-20190314: Oof. My native resolution is 1080p. By default some of the text is almost too small to read, while the movies take up only 25% of the screen.

Using the hidden fullscreen resolution option is broken - the game does ugly nearest neighbor scaling of the UI, and thinks you're clicking in a different place than where the mouse cursor is at.

Using hidden fullscreen resolution with legacy fullscreen seems to be the best option. At 720p I can actually read the mission detail text, and the videos aren't ridiculously tiny.

I would actually prefer the game run at 1080p, but scale (preferably bilinear) the text and videos to something reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
7 participants
You can’t perform that action at this time.