OpenBVE
OpenBVE copied to clipboard
Apple M1 - Text and overlaid graphics don't scale with resolution
Hello, I have OpenBVE running on an Apple M1 MacBook and it appears to work for the most part except for extremely small text and non-train/route overlay graphics regardless of resolution or window size. See this screenshot:
The graphical elements on the bottom for the doors and brakes/acceleration are especially difficult to see, as are the clock and velocity text.
I found issue #680 and associated PR #692 and reviewed those for a possible solution. I confirmed that I have the OpenTK fork installed in my NuGet packages as described in #697, but I'm not sure how to confirm if that's the version that OpenBVE is using when I execute it.
Is this a known ongoing issue with M1 compatibility or is there anything I can troubleshoot locally to try to fix this for my installation?
Versions
- Mac OSX/Hardware: M1 Sonoma 14.3.1
- OpenBVE: 1.5.3172.1078
- Mono: 6.12.0.206
- opentk-openbve (from NuGet): 1.0.2
- opentk.glcontrol-openbve (from NuGet): 1.0.1
That's a different issue entirely by the looks of things.
We should dynamically choose font size based upon detected screen resolution, but it doesn't look like it's happening right.
First, try the most recent version. I know I made some fixes in the last week related to the resolution not getting saved on reload of the game with the GL menu.
The Hackintosh I've got only has 1280x1024 max resolution, but I'll see what I can come up with to test.
Thanks for the quick response. I ran the new 1.11.0.6 release just now. The menu/options seem to be behaving more reasonably as I resize the window, but the in-game text and non-train, non-route graphics* still appear as they do in my original screenshot.
I'm not nearly experienced enough with graphics libraries to think of ways to troubleshoot, but I'm happy to lend my combination of M1 and display (Liquid Retina XDR 16-inch (3456 × 2234)) if you have any test builds.
*for future reference, is there a more concise term I can use to reference simulation text and overlaid graphics that are native to OpenBVE and not defined in Route/Train/Object files?
I don't think there's really any other term than the in-game UI....
I think the largest resolution I'm likely to be able to get hold of is 2560x1440 (on a 27" monitor), but I should be able to deal with something.
Thinking about it though, I think the 'real' issue is probably that we're not handling the desktop scaling factor correctly in windowed mode, which may well be platform agnostic. The PRs linked above were to do with the full-screen switch not working properly on Retina, which whilst related isn't quite the same kettle of fish.
FWIW, as a workaround using fullscreen mode at a smaller resolution, say about 1366x768 would probably work and give you a sensible size UI. Not sure what resolution options it gives you though....
The good news is that your recent updates fixed full-screen on my machine. A couple days ago, entering full screen put the application into a strange state where it still appeared to be a running process, but nothing I did could bring it back into the foreground, windowed or otherwise. With the latest version, I can now enter full screen and keep using the app.
The bad news is that the game UI elements still resize themselves when I do this. They seem to always stay at about the same size. This was in the smallest resolution I could set in the app menu (960x600). I'll play around with desktop display settings, it's possible I'd need to reduce those as well. My screen is currently set to 1728x1117.
Follow up, if I set both in-game and desktop resolution to 960x600 and then go into full screen, it does make things noticeably better. Though I'm not sure they are as big as they're supposed to be, they are at least legible now. Unfortunately getting this benefit does seem to require setting a very low desktop resolution, there are diminishing returns with higher resolutions, even if I match the in-game and desktop resolutions.
OK, that's funky.
The second screenshot definitely isn't as big as it should be. (Should pretty much fill the whole screen with the menu)
Best option may end up being a UI scale toggle thingy, but let me do some testing / playing over the next few days.
https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2024-10-10.dmg
This adds a UI scale option for the in-game UI to the options menu. (Note that the magnification numbers aren't 'true' at the minute, they're actually just toggling through the available font sizes)
This works OK on Windows and the non-retina Hackintosh. It should be good on Retina, but I can't test that.
No changes to how the menu font size is chosen at the minute, that's done independantly of the in-game UI.
That .dmg link is broken, but I found the 2024-10-10 build in the Builds/ folder and installed that.
This definitely helps! This is what I see using the 6x scaling option windowed mode without changing my desktop resolution.
If anything, the bottom elements could be scaled up a little more. I think if the scaling went any higher, the top left text would be too overbearing, but as it stands with 6x, the door and brake/acceleration indicators are just legible.
Good, that does look a bit better, although I did expect it to be larger....
Is it just me, or are the bottom door etc. elements falling off the edge of the screen slightly? (I'm not sure if its an artifact of the curved window borders)
I'll see about some more fiddling, but some of this does come down to personal preference.
In this 10-10 build, changing the resolution to 960 x 600 and the UI scale to 6x makes it so the game crashes if the options menu is re-opened. I'm not sure if it's setting that specific resolution value or not because I changed it to higher ones and it worked fine. I was able to fix and recreate this bug by deleting 1.5.0/options.cfg and restarting the game.
Traceback
2024-10-10 11:21:25
OpenBVE 1.7.1808.622-runner Crash Log
Program is running on the MacOS backend
Current screen resolution is: Windowed 960px X 600px
Current routefile is:
Current train is:
The current routefile caused the following exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at OpenBve.GameMenu.Draw (System.Double RealTimeElapsed) [0x00651] in <8f3360a7e4d84558839ab0f6a55c6f3c>:0
at OpenBve.Graphics.Renderers.Overlays.Render (System.Double TimeElapsed) [0x00727] in <8f3360a7e4d84558839ab0f6a55c6f3c>:0
at OpenBve.Graphics.NewRenderer.RenderScene (System.Double TimeElapsed, System.Double RealTimeElapsed) [0x00eb4] in <8f3360a7e4d84558839ab0f6a55c6f3c>:0
at OpenBve.OpenBVEGame.OnRenderFrame (OpenTK.FrameEventArgs e) [0x00059] in <8f3360a7e4d84558839ab0f6a55c6f3c>:0
at OpenTK.GameWindow.OnRenderFrameInternal (OpenTK.FrameEventArgs e) [0x00010] in <13d03852c6254f51840d199e801a688e>:0
at OpenTK.GameWindow.RaiseRenderFrame (System.Double elapsed, System.Double& timestamp) [0x0000c] in <13d03852c6254f51840d199e801a688e>:0
at OpenTK.GameWindow.DispatchRenderFrame () [0x00038] in <13d03852c6254f51840d199e801a688e>:0
at OpenTK.GameWindow.Run (System.Double updates_per_second, System.Double frames_per_second) [0x00104] in <13d03852c6254f51840d199e801a688e>:0
at OpenTK.GameWindow.Run () [0x00000] in <13d03852c6254f51840d199e801a688e>:0
at OpenBve.MainLoop.StartLoopEx (OpenBve.LaunchParameters result) [0x00284] in <8f3360a7e4d84558839ab0f6a55c6f3c>:0
at OpenBve.Program.Main (System.String[] args) [0x00699] in <8f3360a7e4d84558839ab0f6a55c6f3c>:0 at System.Environment.get_StackTrace () [0x00000] in <207d12884485488d9288cc8cbf474289>:0
at OpenBve.Program.Main (System.String[] args) [0x00000] in <8f3360a7e4d84558839ab0f6a55c6f3c>:0
Current program memory usage: 169.96mb
System memory free: 0mb
Invalid `options.cfg`
; Options
; =======
; This file was automatically generated. Please modify only if you know what you're doing.
[language]
code = en-US
[interface]
folder = Default
timetablemode = default
kioskMode = false
kioskModeTimer = 300
accessibility = false
font = Arial Unicode MS
dailybuildupdates = false
[display]
preferNativeBackend = true
mode = window
vsync = true
windowWidth = 960
windowHeight = 600
fullscreenWidth = 1024
fullscreenHeight = 768
fullscreenBits = 32
mainmenuWidth = 0
mainmenuHeight = 0
loadInAdvance = false
unloadtextures = false
isUseNewRenderer = true
forwardsCompatibleContext = false
uiscalefactor = 6
[quality]
interpolation = bilinearMipmapped
anisotropicFilteringLevel = 0
anisotropicFilteringMaximum = 16
antiAliasingLevel = 0
transparencyMode = 2
oldtransparencymode = true
viewingDistance = 600
quadLeafSize = 60
motionBlur = none
fpslimit = 0
[objectOptimization]
basicThreshold = 10000
fullThreshold = 1000
vertexCulling = False
[simulation]
toppling = true
collisions = true
derailments = true
loadingsway = false
blackbox = false
mode = normal
acceleratedtimefactor = 5
enablebvetshacks = true
enablebve5scriptedtrain = true
[verbosity]
showWarningMessages = true
showErrorMessages = true
debugLog = false
[controls]
useJoysticks = true
joystickAxisEB = true
joystickAxisthreshold = 0
keyRepeatDelay = 500
keyRepeatInterval = 100
raildrivermph = true
[sound]
model = inverse
range = low
number = 16
[packages]
compression = zip
[folders]
route =
train =
[recentlyUsedRoutes]
[recentlyUsedTrains]
[routeEncodings]
[trainEncodings]
[enableInputDevicePlugins]
[Parsers]
xObject = 1
objObject = 0
gdiplus = false
[Touch]
cursor = nk.png
panel2extended = false
panel2extendedminsize = 128
Hmm, I'm not sure what I did, but setting the UI resolution to 6x now crashes the game with that same error now matter if I change the resolution or not. Changing the scale factor makes it so the options menu is permanently inaccessible and opening it crashes the game until options.cfg is deleted.
I think I see what's happening. Something somewhere is adding +1 to the UI scale after it's saved. So if you open options, set UI scale to 4x, close the menu, and open it again, UI scale will be 5x. Likewise with 5x becoming 6x. Since I assume 7x is invalid, it makes sense that setting 6x and then trying to reopen the menu would result in an IndexError.
Yeah, that was my fault. Scale factor of 1 is actually internally zero (i.e. no increase from the default), and I should have been using factor minus 1 to select the option.
Fixed that.