[Solved]How to create video texture correctly in MOGRE?

randomcode

28-08-2017 14:30:13

Hello, I meet some problem when create video texture in MOGRE, the texture rendered is green like this:


Here is my code:

System.Drawing.Bitmap bitmap = videotexMgr.Stream.GetBitmap(videotexMgr.FrameNum);
MemoryStream ms = new MemoryStream();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bitmapBuffer = new byte[ms.Length];
ms.Seek(0, SeekOrigin.Begin);
ms.Read(bitmapBuffer, 0, bitmapBuffer.Length);
ms.Close();

videotexMgr.PixelBuffer.Lock(HardwareBuffer.LockOptions.HBL_DISCARD);
Marshal.Copy(bitmapBuffer, 0, videotexMgr.PixelBuffer.CurrentLock.data, bitmapBuffer.Length);
videotexMgr.PixelBuffer.Unlock();


I use AviFile to read avi files and use Bitmap class receive the frame image data

Please help me!

PS: I have solved this problem, details in this thread:
http://www.ogre3d.org/forums/viewtopic.php?f=5&t=93437