0

Im searching a working DDS image loading library written in C/C++, so far I have tried:

raylib, DevIL and dedicated DDS image libraries

All of them don't work properly, the image looks completely scrambled.

Gimp or other image editing software seems to have trouble too.

When I open the image via Visual Studio 2022 the image get displayed properly. How is this possible?

Here is the full file: https://drive.google.com/file/d/1mmqSlI91S3BkvYxKex1z3Odhu-_VcoGF/view?usp=sharing

The header looks like this:

00000000   44 44 53 20 7C 00 00 00 07 10 0A 00 00 02 00 00  DDS |...........
00000010   00 02 00 00 00 00 04 00 01 00 00 00 0A 00 00 00  ................
00000020   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000030   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000040   00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00  ............ ...
00000050   04 00 00 00 44 58 31 30 00 00 00 00 00 00 00 00  ....DX10........
00000060   00 00 00 00 00 00 00 00 00 00 00 00 08 10 40 00  ..............@.
00000070   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000080   62 00 00 00 03 00 00 00 00 00 00 00 01 00 00 00  b...............
00000090   00 00 00 00 3A DE 48 82 22 59 86 5F 69 8A C0 FE  ....:ÞH‚"Y†_iŠÀþ
000000A0   65 5E E6 A6 68 29 9B CA 24 F3 C9 5C 3A A1 4D 26  e^æ¦h)$óÉ\:¡M&
000000B0   C8 73 65 53 08 31 99 CC 65 D3 D9 6C 3E 9F 4F 27  ÈseS.1™ÌeÓÙl>ŸO'
000000C0   AD AB AC D4 88 31 9F 4E A7 13 0A 85 3E A5 51 29  ­«¬Ôˆ1ŸN§..…>¥Q)
000000D0   B2 B8 B8 B8 C0 E6 F0 59 8C 1A FF FF 31 F8 41 D7  ²¸¸¸ÀæðYŒ...1øA×

Here is the raylib attempt: (non of the textures show valid output)

std::vector<unsigned char> DDS = Utils::LoadBinary("00000@hunkago_01@.DDS");

Image image0 = { &DDS[0], Width, Height, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
Image image1 = LoadImage("00000@hunkago_01@.DDS");

Texture2D texture0 = LoadTextureFromImage(image0);
Texture2D texture1 = LoadTextureFromImage(image1);
Texture2D texture2 = LoadTexture("00000@hunkago_01@.DDS");
Michael
  • 177
  • 2
  • 15
  • Show us your code where you're using `raylib` - it's likely a bug in your code. – Dai Jun 16 '23 at 01:52
  • There is also the PIXELFORMAT_COMPRESSED_DXT5_RGBA format which I also tried, but no PIXELFORMAT_COMPRESSED_DXT10_RGBA? – Michael Jun 16 '23 at 02:03
  • I also compiled raylib with OpenGL 1.x and not 3.3 or higher. But it doesn't make sense that other software cannot open the image either. – Michael Jun 16 '23 at 02:07
  • FWIW, I'm able to view your DDS file just fine in Linqpad by using [an unofficial repackaging of the Paint.NET DDS plugin via NuGet](https://www.nuget.org/packages/DdsFileTypePlusHack): https://imgur.com/a/JbBE93J – Dai Jun 16 '23 at 02:18

0 Answers0