Page 1 of 1

buffer to texture

Posted: Fri Dec 28, 2012 6:40 pm
by khatarat
hi
i have a buffer of an image that i get it from a camera. i want to display this image as a texture on a 3d plane. how can i convert this buffer that is an array of bytes to ITexture?

Re: buffer to texture

Posted: Fri Dec 28, 2012 6:45 pm
by khatarat
i create an IImage pointer to my buffer.
i used following function to convert it to ITexture but it has access Violation error

video::ITexture* FacialMotionCapture::ImageTexture(video::IImage* image, core::stringc name)
{
video::ITexture* texture = m_Driver->addTexture(name.c_str(),image);
texture->grab(); //this line has access violation error
return texture;
}

Re: buffer to texture

Posted: Wed Jan 09, 2013 9:49 pm
by polylux
If you want to display your camera stream I'd recommend a different approach.
1, Create an empty texture using this method
2, Whenever your cam buffer has new data available, call the texture's lock function to get access to the pixel data. Use write access to push the buffer data into the texture
3, Don't forget to unlock the texture and you're good to go
4, Such things rather belong to the beginners' forum ;)

Cheers,
p.