I'm a little new to Unity and Vuforia, and I'm having trouble getting access to the background texture provided in the new SDK.
I've created a GUITexture in my application, and in the ARCamera script, I've placed the following code in the Start function:
QCARRenderer.Instance.DrawVideoBackground = false; DisplayTexture.texture = new Texture2D(0, 0, TextureFormat.RGB565, false); int nativeTextureID = DisplayTexture.texture.GetNativeTextureID(); if (!QCARRenderer.Instance.SetVideoBackgroundTextureID(nativeTextureID)) { Pic = "Failed to setVideoBackgroundTextureID " + nativeTextureID; } else { Pic = "Successfully setVideoBackgroundTextureID " + nativeTextureID; }
I get texture information, and a the set call is true, The texture just renders as black.
Am I missing something obvious here?
Have you tried running the BackgroundTextureAccess sample as-is? The sample includes a Readme that shows how to render the camera image using the ARCamera (and without post-processing effects). I suggest looking at the VideoTextureBehaviour script that is included with the sample.
- Kim