error trying to display semi transparent rectangle
Posted
by
scott lafoy
on Game Development
See other posts from Game Development
or by scott lafoy
Published on 2013-06-24T18:44:45Z
Indexed on
2013/06/24
22:32 UTC
Read the original article
Hit count: 314
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.
© Game Development or respective owner