Hi.
Well what I want to do is create smaller texture from part of another texture.
Basicly I have one big texture 1024x1024 as level sprite sheet then I create sprites objects using "source rectangles" it would be almost ok but.. But if I want that sprire render with some texture velocity (f.e sky, waterfall) then sprite image area is limited not to source rectangle bounds but to sheet's area bounds. So this is why I am trying create smaller textures from big sheet texture for each object.
Here's how it looks:
Ok heres the code how I am coping part of sheet data and createing smaller texture
| Color[ pixels = new Color[pSourceRect.Width * pSourceRect.Height]; |
| |
| Texture2D temp_texture = Globals.Content.Load<Texture2D>(pAssetName); |
| temp_texture.GetData<Color>(0, pSourceRect, pixels, 0, pSourceRect.Width * pSourceRect.Height); |
|
| Texture = new Texture2D(Globals.Graphics.GraphicsDevice, pSourceRect.Width, pSourceRect.Height, 1, TextureUsage.None, SurfaceFormat.Color); |
| Texture.SetData<Color>(pixels); |
And here's that strange thing
as You can see some part of the "bottom" data apears at the top :(
So why is that so, what I am doing wrong?
Thanks in anticipation