I am trying to inegrate Vuforia into our own rendering pipeline. Everything during setup appears to be fine. I can pick up on TrackingResults even. I just can't seem to render the camera image. Everything is done on the main thread. The call to drawVideoBackground fails with no way of knowing why that I can see.
QCAR::State state = QCAR::Renderer::getInstance().begin();
if (QCAR::Renderer::getInstance().drawVideoBackground()) <-- RETURNS FALSE
{
QCAR::Renderer::getInstance().end();
return true;
}
QCAR::Renderer::getInstance().end();
LOGI("Initializing QCAR");
LOGI("Notifying about surface creation");
QCAR::onSurfaceCreated();
LOGI("Setting Init Params");
if (QCAR::setInitParameters(QCAR::GL_20) != 0)
{
LOGE("Failed to setInitParameters.");
return;
}
// QCAR::init() will return positive numbers up to 100 as it progresses towards success
// and negative numbers for error indicators
int initSuccess = 0;
do
{
initSuccess = QCAR::init();
}
while (0 <= initSuccess && 100 > initSuccess);
if (initSuccess != 100)
{
LOGE("Failed to init QCAR.");
return;
}
// Update Surface
LOGI("Updating Surface %d x %d", (int)GetWidth(), (int)GetHeight());
QCAR::onSurfaceChanged(GetWidth(), GetHeight());
// Initialise the camera
if(!QCAR::CameraDevice::getInstance().init())
{
LOGE("Failed to initialize camera");
return;
}
// Configure video background
QCAR::CameraDevice & cameraDevice = QCAR::CameraDevice::getInstance();
QCAR::VideoMode videoMode = cameraDevice.getVideoMode(QCAR::CameraDevice::MODE_DEFAULT);
LOGI("Camera Video Mode %d x %d @ %0.3f", videoMode.mWidth, videoMode.mHeight, videoMode.mFramerate);
QCAR::VideoBackgroundConfig config;
config.mEnabled = true;
config.mSynchronous = true;
config.mPosition.data[0] = 0.0f;
config.mPosition.data[1] = 0.0f;
config.mSize.data[0] = (int)GetWidth();
config.mSize.data[1] = (int)GetHeight();
LOGI("Setting Video Background %d x %d", (int)config.mSize.data[0], (int)config.mSize.data[1]);
QCAR::Renderer::getInstance().setVideoBackgroundConfig(config);
// Start camera capturing
if (!QCAR::CameraDevice::getInstance().start())
{
LOGE("Failed to start camera");
return;
}
// Set camera settings
QCAR::CameraDevice::getInstance().setFlashTorchMode(true);
QCAR::CameraDevice::getInstance().setFocusMode(QCAR::CameraDevice::FOCUS_MODE_CONTINUOUSAUTO);
LOGI("Finished QCAR Init.");
Thanks in advance,
-Randy
I am back to having this same issue again with no real explanation as to why. The output window also does not say why drawVideoBackground is failing. At first I assumed I must have broke something in my code, but I have rolled it back to code that definitely used to work and now it doesn't. I tried updating to the latest SDK and that didn't help either. The only thing I can think of is that iOS 8 has somehow broken it for me and my way of doing things.
Clearly there is something with my configuration that is different than your demo app's (like the fact that I don't have a renderFrameQCAR). Your demo works (although it fails the call for the first two attempts). Mine fails forever, so I never get a video background. I do however pick up and track image targets even though I cannot see them displayed. So clearly the image data is coming in and the camera is working.
Any help would be greatly appreciated,
-Randy