Jump to content
  • Advertisement
Sign in to follow this  

[.net] DevIL .NET not displaying .tga file

This topic is 3971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well I downloaded DevIL .NET to use for displaying images in the map editor I'm currently writing, and it worked great at first - it would load and display anything I wanted, wherever I wanted it, including .tga's with alpha channels. Now, however, any .tga file with an alpha channel gets displayed as the error image (that little x in a box). I looked at the samples that come with the library and the only difference I can see between my code and his is that his picture box is created in the form, whereas mine is created dynamically through code. Relevant code follows:
if (file.ShowDialog() == DialogRestult.OK)
PictureBox picTile = new PictureBox();
picTile.ImageLocation = file.FileName;
picTile.Width = pnlTiles.Width - 17;
picTile.Height = pnlTiles.Width - 17;
picTile.Top = pnlTiles.Controls.Count * pnlTiles.Width;
picTile.MouseClick += new MouseEventHandler(picTile_Click);
picTile.Image = DevIL.DevIL.LoadBitmap(file.FileName);
if (ofd.ShowDialog() == DialogResult.OK)
				m_bmp = DevIL.DevIL.LoadBitmap(ofd.FileName);
				if (m_bmp != null)
					pictureBox.Image = m_bmp;
I tried loading the file to a bitmap first, as he does, but I got the same error (interestingly, m_bmp is not null). The only obvious source of error is that the loaded bitmap's Bitmap.StaticMembers.defaultTransparentColor says "the pointer is invalid" when I look at it in the debugger. Any help would be most appreciated - the project will be done once I get this to work.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!