Hi,
i'm working on a AR application. I'm using openscenegraph to overlap 3D objects 
on a texture in wich i render a video taken from a camera. Now i need to take a 
kind of snapshot of the scene (in which i need the 3d object too off course) in 
every frame in order to put it in a buffer and than send it to a remote 
workstation. The code i use for this snapshot is the following:


Code:


osg::ref_ptr<osg::Image> shot = new osg::Image();

shot->allocateImage(640*2, 480*2, 1, GL_RGB, GL_UNSIGNED_BYTE);

osg::ref_ptr<osg::Camera> camera = viewer.getCamera();

framedata->stPipe->frame = cvCreateImage(cvSize(640*2, 480*2), IPL_DEPTH_8U,3 );

camera->attach(osg::Camera::COLOR_BUFFER, shot.get());

double ts,ts1 = 0;

while (!viewer.done()){
 ts=(double) getTickCount();
 viewer.frame();
 framedata->stPipe->frame->width=shot->s();
 framedata->stPipe->frame->height=shot->t();
 cvSetData(framedata->stPipe->frame,shot->data(),shot->s()*3); 
 framedata->stPipe->run();              
 ts1=(double)getTickCount();
}





If i run my application on my desktop workstation i've not any kind of 
problems..Instead if i run it on a tablet (with 4Gb of RAM,i5 processor) i have 
a slow down of performances..lookin better i've noticed that the problem is the 
line:


Code:

camera->attach(osg::Camera::COLOR_BUFFER, shot.get());




if i take off this line the application runs as before..if i add it the viewer 
cicle runs something like 100 times slower...just on the tablet...on the 
desktop pc i haven't this problem...have you got any ideas?

Thank you very much!

Cheers,
Antonio

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50908#50908





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to