Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [ BUG ] version 2019-01-08 - GetDeviceWidth() / GetMaxDeviceWidth() / Height - MacOS Retina problems

Author
Message
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 9th Jan 2019 02:03
These commands all now return a retina resolution which while technically correct creates issues.

For example when you SetWindowSize( 640, 480, 0 ) the GetDeviceWidth() command returns 1280 but should be 640.

This leads to issues when doing cross platform stuff.

Ideally all resolution commands / settings should be non retina. This would offer the most compatibility across systems or else we'd specifically have to code for retina / none retina systems.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 9th Jan 2019 17:07
I think it makes more sense to use the retina values for everything, so if you use SetWindowSize( 640, 480, 0 ) then it should create a window that is 640x480 pixels on screen, as it would on any other platform's screen. Unfortunately I don't have a retina display to test so I'm not sure how we can get SetWindowSize to use retina values.
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 9th Jan 2019 18:11
Hi Paul, I think it would make more sense to keep everything at none retina. That way code is compatible across different platforms. The way it worked before was to always use none retina sizes in the set / get commands and that worked great across all platforms.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Jan 2019 18:53
I think GetWindowWidth/Height commands would go a long way to solving this problem
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Jan 2019 15:12
Quote: "I think GetWindowWidth/Height commands would go a long way to solving this problem"

That sounds like it could work. @Qube_ would this work for you? GetDeviceWidth has to return 1280 in this case as it represents the number of pixels being drawn, but the new command would return 640 to represent the window size
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 10th Jan 2019 21:09
Quote: "GetDeviceWidth has to return 1280 in this case as it represents the number of pixels being drawn"

It wasn't doing that until recently. It was matching the value set via SetWindowSize

Quote: "That sounds like it could work. @Qube_ would this work for you?"


Adding a new command wouldn't really work out cross platform compliant because :

I use GetMaxDeviceWidth / Height GetDeviceWidth / Height to centre a Window in the middle of the desktop. I also use those commands to scale up a window.

So having new commands really wouldn't help here as :

GetMaxDeviceWidth / Height returns the retina size
GetDeviceWidth / Height returns retina size
SetWindowSize is set via none retina but internally draws the window at retina resolution.

NEW GetWindowWidth / Height couldn't be used to centre a window in the middle of the desktop without doing a * 2 which then wouldn't work on Windows, Linux or anything none retina.

Every one of those commands should return none retina sizes ( just like the SetWindowSize requires ). That way code that works on a Mac also works in Windows, Linux and everything else. MacOS itself doesn't refer to resolutions of 5120 x 2880, it just refers to it as 2560 x 1440 ( but it's HiDPI ).


What we have now on retina is every singe drawing command using none retina, SetWindowSize using none retina but GetDeviceWidth / Height ( and Max versions ) commands returning retina. It doesn't make sense.

As mentioned, this was all returning none retina results in previous versions and has been working for many many months.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Jan 2019 22:50
What if GetMaxDeviceWidth returned the non-retina sizes so it could be used along side GetWidowWidth for the current size and SetWindowSize to set the non-retina size. However GetDeviceWidth would still return the retina pixel size so it can be used for pixel perfect rendering, and as a way to detect a retina display.

This came about because we upgraded to the latest GLFW version which now renders the back buffer at retina resolutions, which is why GetDeviceWidth changed, it has always reported the pixel size of the back buffer.
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 11th Jan 2019 00:26
If GetMaxDeviceWidth / Height and GetWindowWidth / Height both returned the non-retina sizes then that would be perfect as that would emulate the old original behaviour and work cross platform too with no code workarounds
MikeHart
AGK Bronze Backer
20
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 1st Apr 2019 12:46
Is it fixed?
Qube_
9
Years of Service
User Offline
Joined: 21st Oct 2014
Location: Omnipresent
Posted: 1st Apr 2019 17:53
Yes the new GetWindowWidth / Height commands work in the right way.

Login to post a reply

Server time is: 2024-04-19 08:39:32
Your offset time is: 2024-04-19 08:39:32