spnda / dds_image

Single header C++11 DirectDraw Surface (DDS) decoder with Vulkan helpers.
MIT License
16 stars 7 forks source link

possibility to use lib to convert vector of pixel to DDS file ? #5

Open OshidaBCF opened 1 month ago

OshidaBCF commented 1 month ago

As the title says it, is it possible to use the lib to convert an array of "raw" pixels into a DDS file ?

or is writing a dds way easier and i could code it myself easily ?

Great library, easy to use and straight up works

spnda commented 1 month ago

Hi, thank you.

This library currently has no functionality for writing DDS files from raw pixels or blocks, but I don't think it should be to difficult to implement it yourself if you really need it. You could probably just use the library's implementation as a reference and read through the Microsoft DirectX documentation. However, you should be aware that most of the code that happens is to convert legacy header data to make it usable. You should always use the DX10 header for new files. Another option is also just to use something like KTX2 instead, which is a more modern file format for compressed textures.

Also, if you just have raw pixels perhaps just a raw container or writing the bytes directly might also suffice.

OshidaBCF commented 1 month ago

Got it

i'll try to make something.

the reason i want to write dds is because my tool is a texture packer, and we want to support the most "common" formats, png bmp and dds

i managed to make something work with this lib (https://github.com/Pintea/save_dds/) but i changed a lot of things and i'm not happy with it (my changes)