April 25, 2019, 04:17:08 AM

Author Topic: .DDS (DirectDrawSurface) texture support?  (Read 117 times)

Offline Yellownakji

  • Full Member
  • ***
  • Posts: 171
  • Whoop-de-doo-ba-dooo!
.DDS (DirectDrawSurface) texture support?
« on: April 02, 2019, 11:16:43 PM »
Does BlitzMaxNG natively support .DDS images?   I see Loaders for PNG, which is what i normally use, JPEGand TARGA (yuck.).

I'm wondering if there is also support for DDS or perhaps a module that has been previously published for DDS support?  I'm pretty happy with PNG in terms of performance however DDS would be even more optimal, if supported.

Online markcwm

  • Sr. Member
  • ****
  • Posts: 361
Re: .DDS (DirectDrawSurface) texture support?
« Reply #1 on: April 03, 2019, 12:05:40 AM »
Hi,

there is a texture loader for DDS in C++ for Openb3dmax, I've been planning on writing a loader for Blitzmax so we can have DDS texture streams, but I might as well write a pixmap loader module and then it can be used for images too.

I already have a STB Image pixmap factory loader module which supports TGA, PNG (32-bit only), BMP (no RLE), JPG (no progressive), also: GIF, PSD, HDR, PIC. The BRL JPG and PNG loaders are the best but Openb3dmax STBI TGA and BMP loaders are more stable. Brucey has an STBI loader module in NG but his version crashes on most TGAs, it seems when STBI got a rewrite TGAs were broken so Openb3dmax uses the older v1.35.

Offline Yellownakji

  • Full Member
  • ***
  • Posts: 171
  • Whoop-de-doo-ba-dooo!
Re: .DDS (DirectDrawSurface) texture support?
« Reply #2 on: April 03, 2019, 12:39:54 AM »
Hi,

there is a texture loader for DDS in C++ for Openb3dmax, I've been planning on writing a loader for Blitzmax so we can have DDS texture streams, but I might as well write a pixmap loader module and then it can be used for images too.

I already have a STB Image pixmap factory loader module which supports TGA, PNG (32-bit only), BMP (no RLE), JPG (no progressive), also: GIF, PSD, HDR, PIC. The BRL JPG and PNG loaders are the best but Openb3dmax STBI TGA and BMP loaders are more stable. Brucey has an STBI loader module in NG but his version crashes on most TGAs, it seems when STBI got a rewrite TGAs were broken so Openb3dmax uses the older v1.35.

I see, thanks for this information.   I was thinking of DDS since it has GPU advantages but it's not too different from PNG.  My main issue is the different modes of DDS and just recently, several new compression types were introduced and some phased out.  Even Paint.net does not support all of them so it's kind of messy.   DDS support would be handy though, especially for 3D applications.   By the way, if i'm not mistaken, isn't PNG open source?  I've been trying for sometime now to find a file system for PNG.  I'm curious to see how PNG works and how to write a PNG loader/saver.   I know NG has one internally but i'm curious as to seeing how it works myself.

Online markcwm

  • Sr. Member
  • ****
  • Posts: 361
Re: .DDS (DirectDrawSurface) texture support?
« Reply #3 on: April 07, 2019, 07:13:38 PM »
Hi Yellownakji,

thanks for this, yes I now see the advantages you are talking about: first compressed textures in VRAM save memory, second compressed textures also improve GPU performance, third pre-processed mipmaps save loading times.

The DDS loader I'm working on uses glCompressedTexImage2D which it seems does create a compressed texture in VRAM, the code will also loads mipmaps from file. I have just finished getting the loader working along with a LoadImageDDS function but haven't added these optimizations yet as I've only just realized what they are for. I'll update the code to do this where it's possible.

Offline Yellownakji

  • Full Member
  • ***
  • Posts: 171
  • Whoop-de-doo-ba-dooo!
Re: .DDS (DirectDrawSurface) texture support?
« Reply #4 on: April 07, 2019, 09:47:50 PM »
Hi Yellownakji,

thanks for this, yes I now see the advantages you are talking about: first compressed textures in VRAM save memory, second compressed textures also improve GPU performance, third pre-processed mipmaps save loading times.

The DDS loader I'm working on uses glCompressedTexImage2D which it seems does create a compressed texture in VRAM, the code will also loads mipmaps from file. I have just finished getting the loader working along with a LoadImageDDS function but haven't added these optimizations yet as I've only just realized what they are for. I'll update the code to do this where it's possible.

Sounds good.  DDS support for max2d_d9x and max2d_gl would be great.  For modern applications, it would be a reallllyyyy useful format.   It should also work well on older CPUs like a Penium 4 etc.