MTLRender error - iOS & ofxARkit


#1

I’m wanting to fiddle around with OF and ofxARkit but when compiling xCode gives the following error:

2018-12-14 00:32:07.908845+0200 tracAR_1[4033:684945] -[MTLRenderPipelineDescriptorInternal validateWithDevice:], line 2395: error 'vertexFunction must not be nil.'

-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2395: failed assertion `vertexFunction must not be nil.'

As a test I’ve just compiled my generated project with all code from the ‘example-basic’ that comes with ofxARkit. Because of the error I’ve tried to fix all differences between the files but can’t seem to get to the right fix.

Wonder if there is somebody out there that can help me fix this, as it doesn’t seem to be part of the code itself but more of some setting somewhere in xCode. For the sake of being able to try my exact compile I’ve pushed everything to github: https://github.com/RobbertGroenendijk/tracAR_1

I’m compiling to a iPad Pro running iOs 12.1.1

Thanks in advance!


#2

Same problem here, anyone?


#3

So I eventually solved the problem just replicated it in order to clearly show how to solve this error. It’s actually communicated on the ofxARkit wiki on Github but in a way that might not be clear to everyone if you haven’t been working in Xcode much.

ofxARkit wiki - https://github.com/sortofsleepy/ofxARKit/wiki/How-is-the-camera-image-rendered%3F**

  • When creating a new project, the .metal file that contains the shader for processing the camera image is for some reason, marked as a data file instead of a metal shader source. Also, the file is not included in the list of compiled sources. You’ll have to change how XCode views that file as well as add it to the list of compiled sources.**

Follow these steps

  • In Xcode navigate to: addons > ofxARKit > src > lib > Shaders.metal
  • Click the file.
  • Make sure you open the file inspector by clicking the icon in the top right corner.
  • The ‘type field’ will display data. Click the field and change it to Metal Shader Source.

This should make sure Xcode reads this file correctly and will solve the renderer problem.
Let me know if all works out. :wink:


#4

same error.

The solution did it for me, so thanks @RobbertGroenendijk .

I had to tick the Target Membership below though, on Mac 10.14.1 with an Iphone model XS A2097 running iOS 12.1.3 .


ARKit w/Openframeworks || ofxARKit
#5

Just started a new ARkit project and wanted to confirm this as well. Running on an iPad Pro with iOS 12.1.4.