I'm making a eye toy project ( dragon who is "driver" with your arms ) but i have a FPS Problem , to can making operation with my webcam i making some frame ... I pick up the frame in the loop of the main ... a webcam have a max FPS of 30 but 30 FPS to run 3D animation is too slow ...
Code: Select all
void Jeu(IGUIEnvironment* guienv, IVideoDriver* driver , ISceneManager* smgr,IrrlichtDevice* device,CvCapture* capture)
{
/** Un piti cadre autour de l'image de Webcam **/
guienv->addImage(driver->getTexture("cadre.png"),core::position2d<s32>(341,20));
/** Chargement Dragon **/
IAnimatedMeshSceneNode* dragon = DraGon.AffichageDragon(smgr, driver);
/** Gestion Caméra 3D **/
ICameraSceneNode* camera = Irrlichtdessin.GestionCamera(smgr, driver, dragon);
/** Affichage Terrain **/
Irrlichtdessin.AffichageSkybox(smgr, driver);
ITriangleSelector* selector = Irrlichtdessin.AffichageTerrain(smgr, driver , camera);
Irrlichtdessin.GestionCollisionTerrain(smgr, driver, camera, selector);
/** Enleve le curseur de la souris **/
device->getCursorControl()->setVisible(0);
/** Initialisation variables utiles dans la boucle **/
Imagebool=-1;
int lastFPS = -1;
ITexture * TextureWebcam;
IplImage * frame;
while(device->run())
if (device->isWindowActive())
{
/** Scene Draw **/
driver->beginScene(true, true, SColor(0,0,0,0));
smgr->drawAll();
guienv->drawAll();
/** Grab Webcam image and do motion operation **/
Webcam(guienv,driver,smgr,device,capture,TextureWebcam,frame);
driver->endScene();
/** Pour récuperer le FPS **/
int fps = driver->getFPS();
if (lastFPS != fps) // Pour eviter d'afficher toujours le meme FPS si celui ci reste inchangé
{
stringw str = L"Irrlicht Engine - BiGMaC's Adventure ["; str += driver->getName();str += "] FPS:";str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
}
my fps with webcam : 6
without : 600
i don't have 100% CPU process and don't have all my Ram use
Webcam decrease my fps by 100 !!!
May be someone have a solution to my problem ?