I am trying to turn unsigned char * data into the irrlicht texture (from gstreamer, but it is not important here), but I get only some messed B&W picture. The format of input data is
Code: Select all
video/x-raw-rgb,pixel-aspect-ratio=1/1,bpp=(int)24,depth=(int)24,endianness=(int)4321,red_mask=(int)0xff0000, green_mask=(int)0x00ff00, blue_mask=(int)0x0000ff
Code: Select all
CurrentImage = IrrVideoDriver->createImageFromData(irr::video::ECF_A8R8G8B8,
irr::core::dimension2d<irr::u32>(currentW, currentH),
data,
true);
CurrentTexture = IrrVideoDriver->addTexture("movie", CurrentImage);
I think, that the image stride is the problem here, because when I use gdk pixbuf, then the resulting picture is fine:
Code: Select all
/* create pixmap from buffer and save, video buffers have a stride
* that is rounded up to the nearest multiple of 4 */
pixbuf = gdk_pixbuf_new_from_data (buffer,
GDK_COLORSPACE_RGB, FALSE, 8, width, height,
ROUND_UP_4 (width * 3), NULL, NULL);
Many thanks in advance,
Stepan