Loading Textures
Loading Textures
Loading Textures
Loading Textures
Loading Textures
Loading Textures Loading Textures Loading Textures Loading Textures Loading Textures Loading Textures Loading Textures Loading Textures
Loading Textures Loading Textures
Loading Textures
Go Back  Xtreme Visual Basic Talk > > > > Loading Textures


Reply
 
Thread Tools Display Modes
  #1  
Old 06-13-2006, 02:52 AM
scruffyduck scruffyduck is offline
Newcomer
 
Join Date: May 2006
Location: UK
Posts: 14
Default Loading Textures


I have been working with DirectX to be able to render a 3D object (one created for Microsoft Flight Sim). I have run into a problem with textures and I can't seem to get round it.

I am using the function TextureLoader.FromFile(Device, TextureFile)

To get a texture where textureFile is a string containing the full path to the texture file. I can load straight format bmp files fine but the ones I need to load are DXT1 bitmaps and these fail with a very unhelpful error - something like 'application error'. I have looked in the SDK and it seems that DX should be able to handle a whole range of formats. In fact FS textures can be in different formats so I need to be able to load them (preferably without knowing the format first). Any pointers much appreciated
__________________
Jon
www.scruffyduckscenery.co.uk
Reply With Quote
  #2  
Old 06-13-2006, 03:53 AM
Rockoon's Avatar
Rockoon Rockoon is offline
Joseph Koss

* Guru *
 
Join Date: Aug 2003
Location: Unfashionable End
Posts: 3,615
Default

If they are .BMP files, then I highly doubt that they are DXT compressed (the format doesnt support such compression AFAIK)

Usualy DXT compressed files are in .DDS format
Reply With Quote
  #3  
Old 06-13-2006, 04:47 AM
scruffyduck scruffyduck is offline
Newcomer
 
Join Date: May 2006
Location: UK
Posts: 14
Default

Thanks but these are .bmp files as far as I can tell. I attach the one which I am using for testing my program
Attached Images
File Type: bmp ClockTower.bmp (128.1 KB, 7 views)
__________________
Jon
www.scruffyduckscenery.co.uk
Reply With Quote
  #4  
Old 06-13-2006, 05:12 AM
jantje jantje is offline
Junior Contributor
 
Join Date: Dec 2004
Posts: 255
Default

the header is different than any bmp's i've seen. but it's also definatly not a normal dds file.
it looks like a custom file format which has the 'bitmap' stored with dxt1 compression.
Reply With Quote
  #5  
Old 06-13-2006, 05:20 AM
scruffyduck scruffyduck is offline
Newcomer
 
Join Date: May 2006
Location: UK
Posts: 14
Default

Quote:
Originally Posted by jantje
the header is different than any bmp's i've seen. but it's also definatly not a normal dds file.
it looks like a custom file format which has the 'bitmap' stored with dxt1 compression.

It's defined as an extended bitmap format by Microsoft
__________________
Jon
www.scruffyduckscenery.co.uk
Reply With Quote
  #6  
Old 06-13-2006, 06:08 AM
jantje jantje is offline
Junior Contributor
 
Join Date: Dec 2004
Posts: 255
Default

hm, yes you're right. this is the way i would approach it (first idea)
read the bmp header to get important information about the image (such as dimensions)
then create a new dds header based on the data that you've collected (isn't too hard, there lots of info on the net)
copy both of them into 1 byte array and then use LoadTextureFromMemoryEx to load the texture.
Reply With Quote
  #7  
Old 06-13-2006, 06:17 AM
Rockoon's Avatar
Rockoon Rockoon is offline
Joseph Koss

* Guru *
 
Join Date: Aug 2003
Location: Unfashionable End
Posts: 3,615
Default

I've tried several different microsoft programs that can display BMP's, and they all fail on this one.

Are these images from a proprietary microsoft game or something?
Reply With Quote
  #8  
Old 06-13-2006, 06:44 AM
jantje jantje is offline
Junior Contributor
 
Join Date: Dec 2004
Posts: 255
Default

I tested my method and it works.
Attached Files
File Type: zip ClockTower fixed.zip (54.4 KB, 11 views)
Reply With Quote
  #9  
Old 06-13-2006, 06:46 AM
scruffyduck scruffyduck is offline
Newcomer
 
Join Date: May 2006
Location: UK
Posts: 14
Default

Quote:
Originally Posted by Rockoon
I've tried several different microsoft programs that can display BMP's, and they all fail on this one.

Are these images from a proprietary microsoft game or something?

They are used in Microsoft Flight Sim which uses DirectX to display the simulation

The program we use to display them is DXTBMP.exe which is found here

http://www.mnwright.btinternet.co.uk/index.htm
__________________
Jon
www.scruffyduckscenery.co.uk
Reply With Quote
  #10  
Old 06-14-2006, 12:33 AM
scruffyduck scruffyduck is offline
Newcomer
 
Join Date: May 2006
Location: UK
Posts: 14
Default

OK I have it working by using a third party dll which converts to regular 24bit bmps, So at least I can load textures now.
__________________
Jon
www.scruffyduckscenery.co.uk
Reply With Quote
  #11  
Old 06-14-2006, 05:25 AM
jantje jantje is offline
Junior Contributor
 
Join Date: Dec 2004
Posts: 255
Default

What about my approach? It took me only 15 to 20 minutes and is not hard at all. But if you're happy with the dll, then that's good too
Reply With Quote
  #12  
Old 06-14-2006, 06:35 AM
scruffyduck scruffyduck is offline
Newcomer
 
Join Date: May 2006
Location: UK
Posts: 14
Default

Quote:
Originally Posted by jantje
What about my approach? It took me only 15 to 20 minutes and is not hard at all. But if you're happy with the dll, then that's good too
For some reason I didn't see your post until just now - must be my failing eyesight I am going to look now - to be honset if I can avoid the dll then that is one less thing that needs to be packaged with the application
__________________
Jon
www.scruffyduckscenery.co.uk
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Loading Textures
Loading Textures
Loading Textures Loading Textures
Loading Textures
Loading Textures
Loading Textures Loading Textures Loading Textures Loading Textures Loading Textures Loading Textures Loading Textures
Loading Textures
Loading Textures
 
Loading Textures
Loading Textures
 
-->