crnghtz
asked on
DirectX3D TextureLoader.FromFile not working with GIF??
(Sorry, only have 235 points)
I'm trying to execute line 23 (below). However, it draws a vague 'Error in the application' error message. I tried the same line with a BMP and PNG, both worked perfect. I need it to work in GIF format, however.
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'm trying to execute line 23 (below). However, it draws a vague 'Error in the application' error message. I tried the same line with a BMP and PNG, both worked perfect. I need it to work in GIF format, however.
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
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());
}
}
more specificly: 200*200 is ofcouse not the only one which is invalid. Your texture height or width must be any of the follwing:
2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048.
I'm not really sure about 2048, but I know there's a maximum size.
2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048.
I'm not really sure about 2048, but I know there's a maximum size.
ASKER
I made the gif 256*512 and still got the error.
The funny thing is, I can't find an example online where someone is using a GIF with this method.
The funny thing is, I can't find an example online where someone is using a GIF with this method.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
IE: 2*2, 4*4, 2*4 ........ 256*512, 512*512 etc.
200*200 is invalid.