XNA Creators Club Online
Page 1 of 1 (7 items)
Sort Posts: Previous Next

DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

Last post 4/16/2009 8:00 AM by nightzeus. 6 replies.
  • 4/13/2009 8:30 PM

    DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

    Can anyone get the DirectX 3D TextureLoader.FromFile method to work with a GIF? I used the method with a PNG and BMP, both worked perfect, however, I need it to work with a GIF.

    On MSDN it says, "This method supports the following file formats: .bmp, .dds, .jpg, .png, and .gif. "

    http://msdn.microsoft.com/en-us/library/ms130475.aspx



    I posted on experts-exchange and did not find the answer.. Please, anyone have working code?

            private Device device; 
            private Texture texture; 
      
            public Form1() 
            { 
                InitializeComponent(); 
      
                PresentParameters present; 
                present = new PresentParameters(); 
                present.Windowed = true
                present.SwapEffect = SwapEffect.Discard; 
                device = new Device(0, DeviceType.Hardware, this.displayBox, 
                    CreateFlags.SoftwareVertexProcessing, present); 
                device.DeviceReset += OnDeviceReset; 
                OnDeviceReset(null, EventArgs.Empty); 
            } 
      
      
            private void OnDeviceReset(object sender, EventArgs e) 
            { 
                try 
                { 
                    texture = TextureLoader.FromFile(device, Directory.GetCurrentDirectory() + "\\graphics\\tileset.gif", 0, 0, 1, Usage.None, Format.Unknown, Pool.Managed, Filter.None, Filter.None, Color.Magenta.ToArgb()); 
                } 
                catch(Exception ex){ 
                    MessageBox.Show(ex.Message.ToString()); 
                } 
            } 
  • 4/13/2009 9:47 PM In reply to

    Re: DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

    Well the fact that you have tried it as a PNG indicates that it is probably not an animated GIF that you are trying to load. I personally have never loaded a GIF file so I cannot say for 100% that its not an error in the documentation; but the first thing I would try is to load that GIF file into Photoshop (or your image program) and re-save it as a GIF file. Just to make sure that original GIF didn't have any strange corruption or formatting.
  • 4/13/2009 10:53 PM In reply to

    Re: DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

    Thank you for your help. :)

    I tried that and still it does not work. I tried with a few GIFs in fact with the same result.
  • 4/14/2009 2:25 AM In reply to

    Re: DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

    Internally it calls

    http://msdn.microsoft.com/en-us/library/bb172759(VS.85).aspx

    which doesn't support gif.
  • 4/16/2009 12:29 AM In reply to

    Re: DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

    Hmm, interesting. So, does that mean Microsoft's documentation is incorrect?
  • 4/16/2009 1:19 AM In reply to

    Re: DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

    Yes. You should file a documentation update request; you can click the feedback link at the bottom of the page, and enter what you found in the message.

    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 4/16/2009 8:00 AM In reply to

    Re: DirectX 3D TextureLoader.FromFile not working with a GIF as stated by microsoft..

    Thank you all. :))


    I submitted an update request.
Page 1 of 1 (7 items) Previous Next