Log in or register to post comments

Camera frame black

January 17, 2016 - 5:20pm #1

Hello,

I'm trying to have the camera frames displayed on the screen of the smartphone without success. I'm using the code forom ImageTargetsNative but it doesn't help. I'm pretty sure the problem is in the _renderFrame(JNIEnv *, jobject).

My colde looks like:

JNIEXPORT void JNICALL Java_com_qualcomm_QCARSamples_ImageTargets_ImageTargetsRenderer_renderFrame(JNIEnv *, jobject) {

/LOG("Java_com_qualcomm_QCARSamples_ImageTargets_GLRenderer_renderFrame"); // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Get the state from QCAR and mark the beginning of a rendering section QCAR::State state = QCAR::Renderer::getInstance().begin(); // Explicitly render the Video Background QCAR::Renderer::getInstance().drawVideoBackground(); glEnable(GL_DEPTH_TEST); // We must detect if background reflection is active and adjust the culling direction. // If the reflection is active, this means the post matrix has been reflected as well, // therefore standard counter clockwise face culling will result in "inside out" models. glEnable(GL_CULL_FACE); glCullFace(GL_BACK); if(QCAR::Renderer::getInstance().getVideoBackgroundConfig().mReflection == QCAR::VIDEO_BACKGROUND_REFLECTION_ON) glFrontFace(GL_CW); //Front camera else glFrontFace(GL_CCW); //Back camera

glDisable(GL_DEPTH_TEST);


QCAR::Renderer::getInstance().end();

 

I might be missing something (I'm very new to OpenGL).

The for loop within the native code was removed because I don't have any trackables yet. All I want to have is the camera frames. 
From the code I understand that the frames are rendered by:

QCAR::Renderer::getInstance().drawVideoBackground();

but I think there should be some more OpenGL code between QCAR::Renderer::getInstance().begin(); and QCAR::Renderer::getInstance().end();

 

Any help is much appreciated!

Log in or register to post comments