Hi!
I was trying to port our sdk for visionOS.
I was going through the documentation and saw this video: https://developer.apple.com/videos/play/wwdc2023/10089/
Is there any working code sample for it, same goes for arkit c api ?
Couldn't find any links. Thanks in advance.
Sahil
General
RSS for tagDelve into the world of graphics and game development. Discuss creating stunning visuals, optimizing game mechanics, and share resources for game developers.
Post
Replies
Boosts
Views
Activity
can i use the es3.1 api in code?
Hi,
in this WebGPU example: https://skal65535.github.io/curl/index_bug_safari.html
the lighting is wrong compared to Chrome's reference version.
I narrowed the problem to the uniform value 'params.specular' at line 515 not being equal to the expected value 1.2f. The value is set a line at line 1078 in the uniform buffer.
Platform: MacBook M1 Pro Sonoma 14.4.1 (23E224)
Safari Technology Preview: Release 194 (Safari 17.4, WebKit 19619.1.11.111.2)
Works ok with Chrome 124.0.6367.156 (Official Build) (arm64).
Hello, our game Nerd Survivors has been identified as spam. The game is based on an original IP and the only games that should share any resemblance with it are from our company.
Today we got notified the rejection due to the violation of Guideline 4.3 but there is no reference to the other application or even a contact to the other developer.
We do use Unity as our game engine, so some parts of the code might be shared across different games, but i cannot find any other justification of the failure.
"Guideline 4.3(a) - Design - Spam
We noticed your app shares a similar binary, metadata, and/or concept as apps submitted to the App Store by other developers, with only minor differences.
Submitting similar or repackaged apps is a form of spam that creates clutter and makes it difficult for users to discover new apps."
Hi,
Since iOS 17, when setting weight on a SCNMorpher, the normals become completely wrong. As you can see below it only happens when there are vertices along an edge.
Has anyone encountered that problem and found a solution?
Thanks
Reported: FB13798652
I have a unity scene which i have created for vision pro and i have also created a biomatric authentication application for vision os using Xcode and swift. What i want to do is call unity scene after the authentication has taken place form the xcode. now i have seen medium post but it only shows how we can do that for apps, I am not bale to do that for vision Pro
I have followed this post : https://medium.com/mop-developers/launch-a-unity-game-from-a-swiftui-ios-app-11a5652ce476
All this i am doing because as far as i know Apple vision pro is not currently supporting optic id authentication with unity's polyspatial plugin.
Any help on this will be appreciated.
Thank you in advace.
My app stopped working in Mac OS Sonoma 14.0 and I quickly isolated the problem to CGContextDrawLayerAtPoint. Two issues, first of all about 1/2 the time there was no data copied (the updated CGLayer did not show up in the window). Then the app would crash iin libswiftCore.dylib after about 5 updates with a very unusual message: "Fatal error: Duplicate keys of type 'DisplayList' were found in a Dictionary. This usually means either that the type violates Hashable's requirements, or that members of such a dictionary were mutated after insertion". This behavior showed up in builds built with XCode 13 on a Mac OS Montery platform, as well as XCode 15 on Mac OS Ventura when the app was run on Sonoma.
My app uses a very traditional method to create an off-screen graphics context in drawRect:
- (void)drawRect:(NSRect)dirtyRect {
// Obtain context from the current NSGraphicsContext ...
viewNSContext = [NSGraphicsContext currentContext];
viewCGContext = (CGContextRef)[viewNSContext graphicsPort];
drawingLayer = CGLayerCreateWithContext(viewCGContext, size, NULL);
So the exact details of the off-screen drawing area were based upon the characteristics of the window being drawn to.
Fortunately the work-around was very easy. By creating a custom CGBitmapContext everything was resolved. My drawing requirements are very basic, so a simple 32-bit RGB off-screen context was adequate.
colorSpaceRef = CGColorSpaceCreateDeviceRGB();
bitMapContextRef = CGBitmapContextCreate(NULL, (int) rintf(size.width), (int) rintf(size.height), 8, 0, colorSpaceRef, kCGImageAlphaNoneSkipLast);
drawingLayer = CGLayerCreateWithContext(bitMapContextRef, size, NULL);
Once I changed to a bitmap offscreen context, problem resolved.
In my case I verified that the portion of the window that was updated with the CGContextDrawLayerAtPoint was indeed restricted to the dirty part of the view rectangle, at least in Sonoma 14.5.
Hope this helps someone else searching for the issue, as I found nothing in the Forums or online.
Hi,
I am developing Cordova apps/games with in-app purchase products as well as an initial product as non-paid (Free) tier: New users will be able to play freely for a set of games as default at the beginning. Then, if they would like to have more games with different set of attributes or themes, they can add more games with in-app purchases. It is similar to a game called Subway Surfers in App Store I would play in the past.
A new player initiates games as Free Tier. After, let us say 3 games, the user is asked if he/she would like to have more games to play with different scenes/themes in different Tiers, in addition to their disposal: Tier 1, Tier 2 and Tier 3. For example Tier 1 adds 3 more games into the Free Tier games so they can play 6 games in the set;Tier 2 add 6 more games and so 9 games they can play and so on. Each individual game in their set is a variant of others in differing Tiers. If they don't wish and play Free Tier games, they may play them too, with limited set of themes but infinite times.
If a user chooses a tier, let us say Tier 1, and when they play 6 games, they are asked if they would like advance to Tier 2 or Tier 3. If they choose Tier 2, as they complete the respective games they will be asked for Tier 3. However, if they don't wish to advance, again they can play current Tier games as many times as they wish.
It is like non-subscription apps then converted to subscription-based ones. In App Store Connect, I created a number of products for in-app purchases for an app.
How I can deliver this Free Tier games in the app and let users try it and allow them to choose in-app purchase products available in AppStore Connect.
I would appreciate response and support.
Best
Lexxyacc
Hi,
I face a problem that I could not scan a specific Code 39 barcode with Vision framework. We have multiple barcode in a label and almost all Code 39 can be scanned, but not for specific one.
One more information, regardless the one that is not recognized with Vision can be read by a general barcode scanner.
Have anyone faced similar situation?
Is there unique condition to make it hard to scan the barcode when using Vision?(size, intensity, etc)
Regards,
Does anyone know what this might be?
/private/tmp/game-porting-toolkit-20240516-2293-dagdsr/wine/dlls/wow64cpu/cpu.c:356:18: error: assignment to 'DWORD64' {aka 'long long unsigned int'} from 'PVOID' {aka 'void '} makes integer from pointer without a cast [-Wint-conversion]
356 | context->Rsp = NtCurrentTeb()->TlsSlots[2]; / WOW64_TLS_WINEHYBRID_RESERVED_R14 */
| ^
make: *** [dlls/wow64cpu/cpu.cross.o] Error 1
make: *** Waiting for unfinished jobs....
Path: /usr/local/Homebrew/Library/Taps/apple/homebrew-apple/Formula/game-porting-toolkit.rb
==> Configuration
HOMEBREW_VERSION: 4.3.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 8378cc825d83acffd125fb0fec041793df378a57
Last commit: 3 days ago
Core tap JSON: 17 May 05:28 UTC
Core cask tap JSON: 17 May 05:28 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.1.4 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 10-core 64-bit westmere
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.4.1-x86_64
CLT: 15.1.0.0.1.1700200546
Xcode: 15.1 => /Users/raiderpig/Downloads/Xcode.app/Contents/Developer
Rosetta 2: true
when i installed Game porting toolkit 1.1, i got an error such as below:
error: assignment to 'DWORD64' {aka 'long long unsigned int'} from 'PVOID' {aka 'void *'} makes integer from pointer without a cast [-Wint-conversion]
anybody who knows how to solve it
I am trying to store usdz files with SwiftData for now.
I am converting usdz to data, then storing it with SwiftData
My model
import Foundation
import SwiftData
import SwiftUI
@Model
class Item {
var name: String
@Attribute(.externalStorage)
var usdz: Data? = nil
var id: String
init(name: String, usdz: Data? = nil) {
self.id = UUID().uuidString
self.name = name
self.usdz = usdz
}
}
My function to convert usdz to data. I am currently a local usdz just to test if it is going to work.
func usdzData() -> Data? {
do {
guard let usdzURL = Bundle.main.url(forResource: "tv_retro", withExtension: "usdz") else {
fatalError("Unable to find USDZ file in the bundle.")
}
let usdzData = try Data(contentsOf: usdzURL)
return usdzData
} catch {
print("Error loading USDZ file: \(error)")
}
return nil
}
Loading the items
@Query private var items: [Item]
...
var body: some View {
...
ForEach(items) { item in
HStack {
Model3D(?????) { model in
model
.resizable()
.scaledToFit()
} placeholder: {
ProgressView()
}
}
}
...
}
How can I load the Model3D?
I have tried:
Model3D(data: item.usdz)
Gives me the errors:
Cannot convert value of type '[Item]' to expected argument type 'Binding<C>'
Generic parameter 'C' could not be inferred
Both errors are giving in the ForEach.
I am able to print the content inside item:
ForEach(items) { item in
HStack {
Text("\(item.name)")
Text("\(item.usdz)")
}
}
This above works fine for me.
The item.usdz prints something like Optional(10954341 bytes)
I would like to know 2 things:
Is this the correct way to save usdz files into SwiftData? Or should I use FileManager? If so, how should I do that?
Also how can I get the usdz from the storage (SwiftData) to my code and use it into Model3D?
Hi all, I am trying to measure the performce of my video game in iOS platform.
After launching the debugger and caputre GPU workload (with "frame" selected as scope), I can not do performance profiling. The error message is: "Failed to enable shader profiler. (516)".
And if I export the GPU trace and reopen it, the Xcode can not find any compatible devices connected. However, the same device used for capturing is connected.
Device informations are:
Mac device: MacBook Air M2, 2022
Mac OS version: Sonoma 14.4
XCode version: 15.2 (15C500b)
mobile device: iPhone 13 Pro Max
iOS version: 15.0
GPU performance counter can be performed using the same mobile device in my colleague's Mac. So I think there might be something wrong with my Xcode.
Let's say the type of project doesn't work well by using the LSApplicationCategoryType property in Info.plist.
How can I trigger it via code in MacOS?
I use ScreenCaptureKit, CoreVideo, CoreImage, CoreMedia frameworks to capture screenshots on macOS 14.0 and higher.
Example of creating CGImageRef:
CVImageBufferRef cvImageBufferRef = ..;
CIImage* temporaryImage = [CIImage imageWithCVPixelBuffer:cvImageBufferRef];
CIContext* temporaryContext = [CIContext context];
CGImageRef imageRef = [temporaryContext createCGImage:temporaryImage
fromRect:CGRectMake(0, 0,
CVPixelBufferGetWidth(cvImageBufferRef),
CVPixelBufferGetHeight(cvImageBufferRef))];
I have the next results of profiling with XCode Instruments Memory Leaks & Allocations:
there is constantly increasing memory usage, but no memory leaks are detected, and there are many calls to create IOSurface objects, that have been never released.
The most part of memory - All Anonymous VM - VM: IOSurface.
The heaviest stack trace:
[RPIOSurfaceObject initWithCoder:]
[IOSurface initWithMachPort:]
IOSurfaceClientLookupFromMachPort
I don't have any of IOSurface objects created by myself. There are low-level calls to it. In Allocation List I can see many allocations of IOSurface objects, but there are no info about releasing it.
Due to this info, how can I release them to avoid permanent increasing memory consumption?
Hey everyone,
My game got rejected due to Guideline 4.3. Here's the gameplay video:
https://www.youtube.com/watch?v=Vb6uBUsOSDg
Does anyone have experience dealing with Guideline 4.3 and can share some insights?
I already appealed, explaining that my game has online multiplayer battles, but no response yet.
Feeling frustrated after spending six months on this game.
Any advice or suggestions would be appreciated. Thanks!
Working on a vision OS app. I've noticed that even when castsShadow is false, performance goes down the drain when there are more than a few dozen entities that have GroundingShadowComponent. I managed to hard crash the Vision Pro with about 200 or so entities that each had two ModelEntities with GroundingShadowComponent attached but set to castShadows = false.
My solution is to add and remove the GroundingShadowComponent from entities as needed, but I thought maybe someone at Apple might want to look into this. I don't expect great performance with that many entities casting shadows, but I'd think turning the shadow off would effectively disable the component and not incur a performance penalty.
Hi, I've got a well established game in gamemaker, which seems to crash on latest gen ipads. In particular have been able to reproduce in ipad 11-inch M2 in the emulator.
Game launches, shows the splash screen, and seems to crash as it's leaving it, but before launching the game itself, as such the log results are rather limited.
I'm attaching what I can see from the crash, and hope anyone has a suggestion in what might be different in this model of the ipad to warrant this sort of crash. Any leads would be welcome.
Thank you in advance.
I rewrite an old project since OpenGL is deprecated and the downgrade to
High Sierra goes with the lost of the old project.
Here is the drawRect:
- (void)drawRect:(NSRect)dirtyRect
{
[super drawRect:dirtyRect];
if(backgroundColor == 1) glClearColor(0.95f, 1.0, 1.0f, 1.0);
else glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0 ,0.0, -10.0);
// After mistake
I wrote PushMatrix()
glTranslatef(-0.01 ,-0.01, -10.0); // Screen Shot 0
// glTranslatef(-0.25 ,-0.25, -10.0); Screen Shot 1
glLineWidth(1.0);
glRotated(rotationX, 1, 0, 0);
glRotated(rotationY, 0, 1, 0);
glCallList(axes);
// After mistake
I wrote PopMatrix()
// Axes Vertices of xx,y,z are 1.0
// With vertices +/-0.99 nothing is drawn
[self glError];
[self.openGLContext flushBuffer];
}
I hope you Accept my Text and hope you can help me !
Mit freundlichen Grüßen
Uwe
Screen Shot 0
Screen Shot 1
So I have a class that does the selection but what I get back is a total mess. Can anyone help me with the code or possibly point me at an example class that performs a magic wand selection like in photoshop? Below is my current Code but I've also attempted to use metal and I've gotten an identical result in the same amount of time
var red1: CGFloat = 0
var green1: CGFloat = 0
var blue1: CGFloat = 0
var alpha1: CGFloat = 0
selectedColor.getRed(&red1, green: &green1, blue: &blue1, alpha: &alpha1)
var red2: CGFloat = 0
var green2: CGFloat = 0
var blue2: CGFloat = 0
var alpha2: CGFloat = 0
pixelColor.getRed(&red2, green: &green2, blue: &blue2, alpha: &alpha2)
let tolerance = CGFloat(tolerance)
return abs(red1 - red2) < tolerance && abs(green1 - green2) < tolerance &&
abs(blue1 - blue2) < tolerance && abs(alpha1 - alpha2) < tolerance
}
func getPixelData(from image: UIImage) -> [UInt8]? {
guard let cgImage = image.cgImage else { return nil }
let width = Int(cgImage.width)
let height = Int(cgImage.height)
let bytesPerPixel = 4
let bytesPerRow = bytesPerPixel * width
let bitsPerComponent = 8
let bitmapInfo = CGImageAlphaInfo.premultipliedLast.rawValue
var pixelData = [UInt8](repeating: 0, count: width * height * bytesPerPixel)
guard let context = CGContext(data: &pixelData,
width: width,
height: height,
bitsPerComponent: bitsPerComponent,
bytesPerRow: bytesPerRow,
space: CGColorSpaceCreateDeviceRGB(),
bitmapInfo: bitmapInfo) else { return nil }
context.draw(cgImage, in: CGRect(x: 0, y: 0, width: width, height: height))
return pixelData
}
func performMagicWandSelection(inputImage: UIImage, selectedColor: UIColor, tolerance: Float) -> UIBezierPath? {
guard let pixelData = getPixelData(from: inputImage) else { return nil }
let width = Int(inputImage.size.width)
let height = Int(inputImage.size.height)
let bytesPerPixel = 4
let path = UIBezierPath()
var isDrawing = false
for y in 0..<height {
for x in 0..<width {
let index = (y * width + x) * bytesPerPixel
let pixelColor = UIColor(
red: CGFloat(pixelData[index]) / 255.0,
green: CGFloat(pixelData[index + 1]) / 255.0,
blue: CGFloat(pixelData[index + 2]) / 255.0,
alpha: CGFloat(pixelData[index + 3]) / 255.0)
if colorMatches(selectedColor: selectedColor, pixelColor: pixelColor, tolerance: tolerance) {
let point = CGPoint(x: x, y: y)
if !isDrawing {
path.move(to: point)
isDrawing = true
} else {
path.addLine(to: point)
}
} else {
if isDrawing {
path.close()
isDrawing = false
}
}
}
}
if isDrawing {
path.close()
}
return path
}