Sign in to follow this  
devronious

Texture losing colors...

Recommended Posts

My textures lose their proper coloring when I resize the device. This is MDX so the resources are managed. I assume that the reason is because I'm using texture loader wrong or something when creating the managed textures. here's my code:
[source lang=c#]
            FileStream fs = file.OpenRead();
            int b;
            int w = 0;
            int h = 0;
            int bpp = 0;
            for (int i = 0; i < 17; i++)
            {
                b = fs.ReadByte();
                switch (i)
                {
                    case 3:
                        bpp = b;
                        break;
                    case 12:
                        h = b;
                        break;
                    case 16:
                        w = b;
                        break;
                }
            }
            fs.Seek(0, 0);
            this.texture = TextureLoader.FromStream(device, fs, w, h, 0, Usage.None, Format.A8R8G8B8, Pool.Managed, Filter.None, Filter.None, 0);

Share this post


Link to post
Share on other sites
What do you mean by losing colours? I had a problem a while ago where resizing the window would reset the device. Your textures are still there, but this causes the render states to be reset to their default(in my case it would enable lighting). You might to check for this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this