error trying to display semi transparent rectangle
- by scott lafoy
I am trying to draw a semi transparent rectangle and I keep getting an error when setting the textures data.
The size of the data passed in is too large or too small for this resource.
dummyRectangle = new Rectangle(0, 0, 8, 8);
Byte transparency_amount = 100; //0 transparent; 255 opaque
dummyTexture = new Texture2D(ScreenManager.GraphicsDevice, 8, 8);
Color[] c = new Color[1];
c[0] = Color.FromNonPremultiplied(255, 255, 255, transparency_amount);
dummyTexture.SetData<Color>(0, dummyRectangle, c, 0, 1);
the error is on the SetData line:
"The size of the data passed in is too large or too small for this resource."
Any help would be appreciated.
Thank you.