In CvIrrCamTexture.cpp, lines 22-26
Code: Select all
//make the texture
if(use_rgba_texture)
this->irr_texture = this->driver->addTexture(core::dimension2d<s32>(cv_img->width, cv_img->height), unique_tex_name, video::ECF_A8R8G8B8);
else
this->irr_texture = this->driver->addTexture(core::dimension2d<s32>(cv_img->width, cv_img->height), unique_tex_name, video::ECF_R8G8B8);
In my project, I've changed core::dimension2d<s32> to core::dimension2d<u32>, which is the same change I've been making to the IrrlichtDevice *device = createDevice(...) call in other projects.
When I run this, I get an object with a recognisable webcam image, but it is distorted/repeated. My wife says that it's the best I've ever looked on a webcam but that's besides the point
I'm trying to work out where in the process this is going wrong, and what elements I would need to study further and redress. I'm slightly out of my depth with this aspect of things and any pointers in the right direction would be gratefully received.
I am using the following code - again taken the previously noted thread, but without the extra meshes;
Code: Select all
int main(){
IrrlichtDevice *device = createDevice(video::EDT_OPENGL, dimension2d<u32>(640, 480), 16, false, false, false, 0);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(vector3df(60,10,0));
camera->setTarget(vector3df(0,0,0));
CvIrrCamTexture* cv_text_mgr = new CvIrrCamTexture(driver,0,0);
IBillboardSceneNode* our_bill_node = smgr->addBillboardSceneNode(NULL, dimension2d<f32>(25.0f, 25.0f),vector3df(0,0,0));
our_bill_node->setMaterialFlag(video::EMF_LIGHTING, false);
our_bill_node->setMaterialTexture( 0, cv_text_mgr->getTexture() );
while(device->run())
{
//update webcam texture
cv_text_mgr->UpdateTexture();
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}