Log in or register to post comments

using a 3d engine

March 18, 2012 - 10:25am #1

hi,
first, thanks allot for this great product!

i want to use vuforia AND use Ogre3D render engine for the 3d part.

however, when i tried to integrate vuforia and ogre i ran into allot of troubles:

the main issues is that vuforia hogs the camera and opengl!

first, i needed to change my run loop to be vuforia's renderFrameQCAR function - otherwise i could not render my scene.

second, i couldn't use my own capture session - it clashes with vuforias.
vuforia hogs the camera :-\
the 3d engine has its own context (and so i disabled vuforia's context) and so i cannot draw the video using vuforia.
also, i want also to search for QR codes with another library (zbar) so i took the frame with state->getFrame()->getImage function

the biggest problem is that the camera fps is low now (on iphone 4 its low even without 3d molded loaded).
(which wouldn't happened with capture session..)
the camera should be smooth! marker detection should take more time if needed.. but vuforia force them into one loop.

the best scenario is that i could give vuforia an image and it would tell me what markers are there..

or that vuforia will be somehow on the background..

please, good peaple of vuforia! how can i use your great product with another 3d render engine?!
i tried so many things.. : (
if only i could use an AVcaptureSession

thanks allot,
dovi

using a 3d engine

November 4, 2012 - 11:59am #9

You are correct about the camera's frame rate - the interval is actually fixed.

Please share any code that you can.

using a 3d engine

November 4, 2012 - 10:47am #8

double post ...

 

using a 3d engine

November 4, 2012 - 10:46am #7

Ok, i managed to integrate the two. I did the following:

Read out the camera frame (qcar), created a dynamic texture (ogre3d) used as 2d background (ogre3d).

I noticed that if used in a single thread, you fps will be around 30 fps, which i think is due to the fact that the camera can't record any faster than 30fps.

I probably gonna run the two in separate threads, locking the dynamic texture on each qcar write.

using a 3d engine

October 3, 2012 - 7:06am #6

I have the following:

- (void)renderFrameQCAR
{
    if (APPSTATUS_CAMERA_RUNNING == qUtils.appStatus) {
       
        [self setFramebuffer];
       
        Ogre::EAGLES2Context *context = 0;
        ((Ogre::EAGL2Window *)OgreFramework::getSingleton().m_pRenderWnd)->getCustomAttribute("GLCONTEXT", &context);
        if([EAGLContext currentContext] != context->getContext()) {
            context->setCurrent();
        }
       
        if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isActive())
        {
            mStartTime = OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
           
            OgreFramework::getSingletonPtr()->m_pMouse->capture();
           
            OgreFramework::getSingletonPtr()->updateOgre(mLastFrameTime);
           
            OgreFramework::getSingletonPtr()->m_pRoot->renderOneFrame();
           
            mLastFrameTime = OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU() - mStartTime;
        }
        renderScene();
        [self presentFramebuffer];
    }
}

 

When i do this, the screen is black. When i remove the following:

renderScene();
        [self presentFramebuffer];

I see the ogre3d scene being rendered. 

 

Any ideas?

using a 3d engine

September 29, 2012 - 10:47pm #5

Sorry for late reply.

 in the setFrameBuffer or presentFrameBuffer function?

No. setting context to current needs every frame. And too late on presentFrameBuffer because OGRE uses GL resources before presentFrameBuffer.

I'm not apply any change to OGRE's source code for using vuforia. Setting GL context to current in Ogre::FrameListner::frameStarted or just before calling Ogre::Root::getSingleton().renderOneFrame in your AppDelegate, it may work.

 

using a 3d engine

September 21, 2012 - 9:43pm #4

Hi,

I'm also trying to get ogre3d and vuforia integrated with eachother. However I couldn't quite grasp where I need to put the code to set the ogre3d context? Is this done in the setFrameBuffer or presentFrameBuffer function?

And how do i subview the ogre eaglview to this view?

 

Regards

Re: using a 3d engine

June 10, 2012 - 8:47pm #3

Hi,

I'm using Vuforia with OGRE too, and I had had a same problem, and solved it.

I gave up to draw VideoBackground for OGRE's framebuffer, I create a independent UIView inherited AR_EAGLView and addSubview it below OGRE's EAGLView.

OGRE never set own GL Context to current since set it once on initializing.
Then I set OGRE's context to current before rendering explicitly on every frame like below:

Ogre::EAGLES2Context *context = 0;
((Ogre::EAGL2Window *)OgreFramework::getSingleton().m_pRenderWnd)->getCustomAttribute("GLCONTEXT", &context);
if([EAGLContext currentContext] != context->getContext()) {
    context->setCurrent();
}

Ogre::Root::getSingleton().renderOneFrame((Ogre::Real)differenceInSeconds);

Re: using a 3d engine

March 19, 2012 - 5:25am #2

Hi tripledov,

I'm sorry but we don't have any experience with OGRE - maybe somebody else on the forum does?

It may be faster, with SDK 1.5, to use Background Texture Access to get an image to process. This is available as a texture which can be rendered using a shader to a framebuffer, which you can then access using CVPixelBuffer. You'd need to also render the texture in the main framebuffer in order to see the camera. See the BackgroundTextureAccess sample app for details.

If you have the time and skills you could even write your own image processer as a shader, that runs in the GPU. :-)

Log in or register to post comments