Log in or register to post comments

Why would drawVideoBackground fail?

January 18, 2014 - 7:05pm #1

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();

 
 
I have tried to simplify the app down to its simplest form and borrowed some of this initialization from another thread here.  But I am still getting the same results.
 

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

Why would drawVideoBackground fail?

November 1, 2014 - 1:52am #5

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

Why would drawVideoBackground fail?

January 21, 2014 - 2:53am #4

I believe the key was switching to OpenGL 2.0.

Yes  everything seems to run much better using 2.0.

Thanks for the update.

 

N

Why would drawVideoBackground fail?

January 20, 2014 - 4:39pm #3

Hello, bindVideoBackground was failing as well.  I changed dozens of things trying to figure out what it was, I beleive the key was switching to OpenGL 2.0.   Anyway, I am now able to move on.  It would have been helpful to be able to step into that function to see why it was failing though.  Or have the documentation list the reasons why it could return false.

Thanks for the info,

-Randy

Why would drawVideoBackground fail?

January 20, 2014 - 3:09am #2

Hi Randy,

It is worth trying bindVideoBackground() instead of drawVideoBackground()  to render the camera image.  Have a look at the background texture access sample to see how this is used.  Also it is worth searching the forums for bindVideoBackground as well.

HTH

N

Log in or register to post comments