Yi Jiang
Yi Jiang

Reputation: 4028

How to transparent Google VR SDK's cardboard view scene's background to show camera preview?

Like the TreasureHunt example, there are black background with blue ground and six colour cube. What I expecting is make the scene black background disappear (transparent or clear colour), and show my replicated camera previews. Something like AR effect.

However, in the main view controller, the loadView(), when I set up the background clear colour for _cardboardView, it doesn't work. the VR scene background is black.

self.view = _cardboardView;
_cardboardView.backgroundColor = [UIColor clearColor];
_cardboardView.layer.backgroundColor = (__bridge CGColorRef _Nullable)([UIColor clearColor]);
self.view.backgroundColor = [UIColor clearColor];  

Or when I setup any distinguished colour here, the VR scene background is still black.

Upvotes: 0

Views: 291

Answers (1)

James
James

Reputation: 116

Besides the backgroundColor, set opaque NO for all the sublayers of the carboardView.layer. It works when vrModeEnabled is NO. I have no idea when vrModeEnabled is YES.

Upvotes: 1

Related Questions