Post

Replies

Boosts

Views

Activity

What is the color space of the environment texture of AREnvironmentProbeAnchor?
The documentation says the pixel format of the environmentTexture in an AREnvironmentProbeAnchor is bgra8Unorm_srgb. https://developer.apple.com/documentation/arkit/arenvironmentprobeanchor/2977511-environmenttexture However, when I inspect the pixelFormat property of the MTLTexture it says it's rgba16Float. I'm trying to read the texture out as a PNG, and because it's a 16-bit float image, I'm assuming its color space is CGColorSpace.displayP3, but I'm not 100% sure. The texture looks darker than what I expected. Could it be that the color space is sRGB, but it's 16-bit because it's actually an HDR texture stored as linear RGB? (Tested on iPhone 12, iOS 15)
2
0
1.1k
Dec ’21
How to get real screen size in Mac Catalyst
I'm trying to port a game to macOS using Mac Catalyst. The game content doesn't dynamically resize and I'm trying to force a fixed 3:4 aspect ratio (like an iPad on portrait) at the start of the app, so I've added this to my AppDelegate class: 	func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         #if targetEnvironment(macCatalyst) 						/* some margin */             let titleHeight: CGFloat = 34 * 4             UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.forEach { windowScene in                 windowScene.titlebar?.titleVisibility = .hidden                 /* screen seems to always be 1920x1080 ??? */                 let height = windowScene.screen.nativeBounds.height - titleHeight                 let width = 3 * height / 4                 windowScene.sizeRestrictions?.minimumSize = CGSize(width: width, height: height)                 windowScene.sizeRestrictions?.maximumSize = CGSize(width: width, height: height)             }         #endif 	} That works in fixing the aspect, but the window looks small in a 15-inch MacBook Pro. nativeBounds is always 1920x1080, where the native resolution should be 1920x1200. UIScreen.main gives me 1920x1080 as well. How can I get the real size of the screen?
4
0
5.6k
Jun ’20