Log in or register to post comments

Locking in a trackable's position?

July 2, 2012 - 7:54am #1

I'm looking for the best way to go about using QCAR to initially detect the frame marker, render the object, but not update the position after the intial rendering. I've tried a few methods, such as only pulling the matrix44F from the trackable once,

if(!set){

  modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());  

  set=true;

}

but that works for perhaps a fraction of a second before the model (I'm using just a simple plane with an image drawn to it) increases in size and is no longer visible. I'm guessing this is due to some modifications made to the model before it is rendered, such that it relies upon fresh values each call to the renderQCAR method, but I'm still stuck. I'm not too keen on just blindly commenting out OpenGL snippets, so I haven't much experimented there, but any help would be much appreciated.

Locking in a trackable's position?

July 3, 2012 - 8:48am #5

Hi cshell

On the assumption that you are using the EAGLView.mm from say ImageTargets as a starting point..

The code in renderFrameQCAR() is where you need to look.

If you want the camera feed on you need the following:

    [self setFramebuffer];

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Render video background and retrieve tracking state

    QCAR::State state = QCAR::Renderer::getInstance().begin();

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

If you want to just finish up without rendering anything you need the following:

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

    [self presentFramebuffer]; 

 

So just to summarise - this will keep tracking everything and display the video feed.  What (I think) you want to do is to set some flag upon the first detection and use this to control exactly when and what you render.  Check the teapot code for the key rendering steps and how the pose matrix is utilised here.

HTH

N

 

 

 

Locking in a trackable's position?

July 3, 2012 - 7:38am #4

In a nutshell, I'm trying to pause the AR but leave the camera feed running. the pauseAR method within the Qutils locks up everything, I'm just wondering how to best achieve that. I realize this is an unorthodox question, but it is the first step in where I'm looking to go with this project in the long term, so any help/suggestions would be much appreciated.

Locking in a trackable's position?

July 2, 2012 - 9:12am #3

Sorry for the lack of clarity in my first post, but thank you for the prompt response. Essentially, I'd like to have QCAR scanning until it first finds the frame marker. At the point of finding the marker, render accordingly, but from there leave the model as is on screen. Camera feed still runs, but the model is locked into the position at which it was intially seen by the QCAR, and from that point don't update. The snippet that I posted makes use of the method you suggested, I know about how to pull the pose from the marker, however, upon attempting to call it only one time, as I stated before, resulted in the aforementioned problem where the model would go out of proportion.

My project is a derivative of the frameMarker sample, for what it's worth. 

Locking in a trackable's position?

July 2, 2012 - 8:57am #2

Hi cshell

Just so I understand correctly:

".. initially detect the frame marker, render the object, but not update the position after the intial rendering"

so what do you want to happen if the frame marker is moved, or if the camera moves?

Basically it is this line that gets the pose / matrix

QCAR::Matrix44F modelViewMatrix = QCAR::Tool::convertPose2GLMatrix(trackable->getPose());

...so maybe this is what you want to call only once?

N

Log in or register to post comments