Log in or register to post comments

Vuforia always set to OpenGL ES 2.0

August 6, 2019 - 1:00am #1

Greetings,

 

I am trying to implement Unity into React Native using a plugin from the following link https://github.com/f111fei/react-native-unity-view.

I successfully put Vuforia to be compiled alongside the app, but whenever I tried to compile the application Vuforia always set the rendering to OpenGL ES 2.0. Here's some log I gathered after I run the app:

Initializing Vuforia...

2019-08-06 14:42:47.621329+0700 unityreact4[1053:77026] User pre-granted access to the camera

2019-08-06 14:42:47.621433+0700 unityreact4[1053:77026] INFO/AR(1053) 2019-08-06 14:42:47: Vuforia selected rendering API OpenGL ES 2.x

2019-08-06 14:42:47.621476+0700 unityreact4[1053:77026] INFO/AR(1053) 2019-08-06 14:42:47: Vuforia SDK version 8.3.8

2019-08-06 14:42:47.621504+0700 unityreact4[1053:77026] INFO/AR(1053) 2019-08-06 14:42:47: Vuforia SDK build 3621

2019-08-06 14:42:47.690246+0700 unityreact4[1053:77026] INFO/AR(1053) 2019-08-06 14:42:47: Matched precache profile for Apple, iPad7,5, iOS 12, 800.1

2019-08-06 14:42:48.997315+0700 unityreact4[1053:77026] INFO/AR(1053) 2019-08-06 14:42:48: Vuforia Fusion: Detected and enabled use of ARKit

2019-08-06 14:42:48.999518+0700 unityreact4[1053:77026] Rendering mode set to: OpenGL ES 2.0

2019-08-06 14:42:49.036414+0700 unityreact4[1053:77026] Rendering mode set to: OpenGL ES 2.0

2019-08-06 14:42:49.037062+0700 unityreact4[1053:77026] DEBUG/AR(1053) UIView has CAMetalLayer layer class

2019-08-06 14:42:49.037287+0700 unityreact4[1053:77026] DEBUG/AR(1053) UIView does not respond to selector renderFrameVuforia

It's really weird because I really need the app to run with Metal and I already forced the Unity Graphics API's into Metal.

 

I tried to run the app without using react-native way and the output was correct! It's using Metal for its rendering API. Here's some log from it:

Initializing Vuforia...

2019-08-06 13:44:58.044546+0700 unityreact4[975:63447] User pre-granted access to the camera

2019-08-06 13:44:58.044615+0700 unityreact4[975:63447] INFO/AR(975) 2019-08-06 13:44:58: Vuforia selected rendering API Metal

2019-08-06 13:44:58.044632+0700 unityreact4[975:63447] INFO/AR(975) 2019-08-06 13:44:58: Vuforia SDK version 8.3.8

2019-08-06 13:44:58.044646+0700 unityreact4[975:63447] INFO/AR(975) 2019-08-06 13:44:58: Vuforia SDK build 3621

2019-08-06 13:44:58.097371+0700 unityreact4[975:63447] INFO/AR(975) 2019-08-06 13:44:58: Matched precache profile for Apple, iPad7,5, iOS 12, 800.1

2019-08-06 13:44:59.658717+0700 unityreact4[975:63447] INFO/AR(975) 2019-08-06 13:44:59: Vuforia Fusion: Detected and enabled use of ARKit

 

My question is how does Vuforia detect the rendering API to be used at the initialization of the app? Maybe I could configure some specific file or settings on XCode to be read later by Vuforia framework and initialize its rendering API into Metal

 

Thanks

Vuforia always set to OpenGL ES 2.0

October 9, 2019 - 1:33pm #5

Hey guys,

Did you found any solution ?

I am also facing the same issue when merging unity app with Native app. 

 

Vuforia always set to OpenGL ES 2.0

August 6, 2019 - 11:09pm #4

(Update)

I was reading how VuforiaUnityPlayer.h works, and looks like there's a method called initQCARiOS. I tried to find all of the scripts containg 'initQCARiOS' and suspect there's a part called Vuforia.UnityExtensions1.cpp which had this line:

 

int32_t L_4 = IOSUnityPlayer_initQCARiOS_m84BC6F102A88721658DDAF7926D5F52922E4972D(L_1, L_2, L_3, /*hidden argument*/NULL);

 

I noticed on top of that line there's a method called GetRendererAPI, which maybe called Unity's choice of render API. I change the output to 2 (Metal) as explained in here: https://library.vuforia.com/content/vuforia-library/en/reference/unity/classVuforia_1_1VuforiaRenderer.html

The result it was initialized in Metal. Here's the dump code I gathered:

Initializing Vuforia...

2019-08-07 10:20:08.453624+0700 unityreact4[1208:149363] User pre-granted access to the camera

2019-08-07 10:20:08.453676+0700 unityreact4[1208:149363] INFO/AR(1208) 2019-08-07 10:20:08: Vuforia selected rendering API Metal

2019-08-07 10:20:08.453693+0700 unityreact4[1208:149363] INFO/AR(1208) 2019-08-07 10:20:08: Vuforia SDK version 8.3.8

2019-08-07 10:20:08.453707+0700 unityreact4[1208:149363] INFO/AR(1208) 2019-08-07 10:20:08: Vuforia SDK build 3621

2019-08-07 10:20:08.508179+0700 unityreact4[1208:149363] INFO/AR(1208) 2019-08-07 10:20:08: Matched precache profile for Apple, iPad7,5, iOS 12, 800.1

2019-08-07 10:20:10.615716+0700 unityreact4[1208:149363] INFO/AR(1208) 2019-08-07 10:20:10: Vuforia Fusion: Detected and enabled use of ARKit

but the problem persists.

I also tried the delayed initialization method because maybe Vuforia being initialized before Unity component being called (as explained from this article https://medium.com/@xinyustudio/vuforia-delayed-initialization-explained-3eddfd02ac6), but the screen still black (but of course, the image recognition still working).

 

I investigate further and found this part of dump log:

 

2019-08-07 12:10:24.144059+0700 unityreact4[1260:187356] INFO/AR(1260) 2019-08-07 12:10:24: Vuforia Fusion: Detected and enabled use of ARKit

2019-08-07 12:10:24.144959+0700 unityreact4[1260:187356] DEBUG/AR(1260) UIView has CAMetalLayer layer class

2019-08-07 12:10:24.148389+0700 unityreact4[1260:187356] DEBUG/AR(1260) UIView does not respond to selector renderFrameVuforia

2019-08-07 12:10:24.148626+0700 unityreact4[1260:187356] DEBUG/AR(1260) Could not find a UIView with CAEAGLLayer or CAMetalLayer layer class that responds to selector renderFrameVuforia

2019-08-07 12:10:24.148846+0700 unityreact4[1260:187356] DEBUG/AR(1260) UIView has CAMetalLayer layer class

2019-08-07 12:10:24.149036+0700 unityreact4[1260:187356] DEBUG/AR(1260) UIView does not respond to selector renderFrameVuforia

2019-08-07 12:10:24.149225+0700 unityreact4[1260:187356] DEBUG/AR(1260) UIView has CAMetalLayer layer class

2019-08-07 12:10:24.149422+0700 unityreact4[1260:187356] DEBUG/AR(1260) UIView does not respond to selector renderFrameVuforia

2019-08-07 12:10:24.149628+0700 unityreact4[1260:187356] DEBUG/AR(1260) Could not find a UIView with CAEAGLLayer or CAMetalLayer layer class that responds to selector renderFrameVuforia

2019-08-07 12:10:24.151296+0700 unityreact4[1260:187356] INFO/AR(1260) 2019-08-07 12:10:24: Vuforia resumed.

 

the interesting part was "DEBUG/AR(1260) UIView does not respond to selector renderFrameVuforia". Maybe that's the culprit?

Vuforia always set to OpenGL ES 2.0

August 6, 2019 - 7:10pm #3

Hello, thank you for your reply,

The projects was copy of the same project but they are on separate folder. I rechecked it and the graphic API is indeed Metal. I also tried to recompile it but the problem still the same. As additional information, image recognition was working but only the camera won't output the captured environment. Our app currently trying to also use ARKit, and the camera output from ARKit using Unity's XR plugin seems works well.

I really confused as I only provide Metal as graphics API from Unity but the library detect OpenGLES2 for the rendering. I'm really curious where does Vuforia gathered the information from when Unity project exported as XCode project. Maybe I can tweak that specific file (which Vuforia use to initialize graphic API) to check whether Metal or OpenGLES2 was the graphic API of choice.

Vuforia always set to OpenGL ES 2.0

August 6, 2019 - 6:12am #2

Hi,

Vuforia will select the build settings from Unity. The second example was timed at 13:44 and it worked with Metal.The first example is timed at 14:44 and you mention that you added Vuforia to the native React project. Could it be that you didn't change the build settings for your native React project?

My advice would be to check again the build settings for the project that hold both the native React and Vuforia and make sure that only Metal is selected.

Thank you.

Vuforia Engine Support

Log in or register to post comments