Hi,
I'm trying to create a Texture from a Surface, but I seem to be unable to do so. Could someone take a look at my code and tell me what I'm doing wrong?
_effectSurface = Surface.CreateRenderTarget(_graphigsDevice, pictureBox.Width, pictureBox.Height, Format.A8R8G8B8, MultisampleType.None, 0, true);
DataRectangle data = _effectSurface.LockRectangle(LockFlags.ReadOnly);
_effectTexture = Texture.FromStream(_graphigsDevice,
data.Data,
(int)data.Data.Length,
pictureBox.Width,
pictureBox.Height,
0,
Usage.None,
Format.A8R8G8B8,
Pool.Default,
Filter.None,
Filter.None,
0);
_effectSurface.UnlockRectangle();
I get an "Invalid Data". I also tried FromMemory but it's the same.
Regards,
sick.