Skip to main content
GameDev.net gamedev.net
🔒 Locked

[.net] DDS Loading in .NET 2.0

Started by Greg K Apr 14, 2006 at 1:01 AM 6 replies 2.1k views
Original Post
Greg K
Greg K
Is there any function to load a DDS file into a bitmap? (ie: to be used on a button or some other gui element). .Net is so huge I would have imagined that such a function would be built in, however if it is I have yet to find it. I wrote some old c++ code that I could port over, but if anyone knows of a built in function I would rather use that. Thanks, Greg
jfclavette
jfclavette
Quote:
Original post by Greg K
Is there any function to load a DDS file into a bitmap? (ie: to be used on a button or some other gui element).

.Net is so huge I would have imagined that such a function would be built in, however if it is I have yet to find it. I wrote some old c++ code that I could port over, but if anyone knows of a built in function I would rather use that.

Thanks,
Greg


A DDS is a DirectDraw surface. The intent wasn't really for them to be used as generic bitmaps. The closest thing to what you want probably comes in the form of Microsoft.DirectX.Direct3D.TextureLoader, but adding a reerence to Direct3D just for that is kinda weird. Any reason why you need to use a .dds ?

You could write a converter yourself really easily using TextureLoader.FromFile() and TextureLoader.Save methods.
I teleported home one night; With Ron and Sid and Meg; Ron stole Meggie's heart away; And I got Sydney's leg. <> I'm blogging, emo style
Greg K
Greg K
We are using them as textures for our game. I only need to display samples of them in my application. It looks like it will be easier to just load them manually rather than start up DirectX just for loading textures.

Thanks,
Greg
Greg K
Greg K
yeah, I already wrote a custom loader in c++ so it is pretty trivial to move it to managed c++. Thought I would try anyway.

-Greg
fsteveb
fsteveb
I have been trying to write a DDS loader in c++, but am having trouble with the compressed DXT formats. I'm displaying in MFC, so don't need to go managed, but there should be a simple display function somewhere. I looked at Ndivia, which it seems used to have code, but now I don't see any. I also need to display a window to preview the texture.
Steve
Promit
Promit
You could kick up a mock REF device for the life of your application and load the texture into system memory, reading off the data, and then destroying it.

Yeah, it's kinda akward, but it's quick to do and will work flawlessly without mucking around the DDS format.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Greg K
Greg K
I would recommend loading the DDS texture from disk and decompressing it manually. Wikipedia does an ok job of describing the format. Once you understand it, it is not too difficult to decompress.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.