Log in or register to post comments

Getting errors when adding Vuforia view as a subview

December 26, 2017 - 9:35am #1

I'm trying to add the Vuforia view as a subview instead of the main view. CORRECTION: Before the error was caused by recursively calling loadView. However I moved all the initialization code to viewDidLoad, and I'm still getting a black background and errors

2017-12-26 13:20:21.646356-0500 deleteSCNGLTest[23190:8443509] Unable to bind video background texture!!

after Rendering of the video background failed() glError (0x506)

Permission has been given to use the camera, everything works fine when I change the code back, and the viewFrame for the subview is

(origin = (x = 0, y = 0), size = (width = 640, height = 1136))

so I know there's something being shown. Any ideas what I need to do to get this to work?

Getting errors when adding Vuforia view as a subview

December 26, 2017 - 12:51pm #2

I think there may be a bug in the Vuforia sample code. In the function

- (CGRect)getCurrentARViewFrame
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGRect viewFrame = screenBounds;
// If this device has a retina display, scale the view bounds
// for the AR (OpenGL) view
if (YES == _session.isRetinaDisplay) {
viewFrame.size.width *= [UIScreen mainScreen].nativeScale;
viewFrame.size.height *= [UIScreen mainScreen].nativeScale;
return viewFrame;
}

The lines

if (YES == _session.isRetinaDisplay) {
viewFrame.size.width *= [UIScreen mainScreen].nativeScale;
viewFrame.size.height *= [UIScreen mainScreen].nativeScale;
}

seem to be unnecessary. In the case of a retina display, iOS already doubles the backing store, so there's no need to double the size of the frame. For some reason, my code was drawing on the right side of the buffer, which was off the side of the screen. I removed these lines and all the samples I tried still worked fine and it fixed the bug I was seeing with no drop in resolution.

Log in or register to post comments