I need a sample of how to load a DDS into a surface. Anyone has a sample on how to do this?
I need a sample of how to load a DDS into a surface. Anyone has a sample on how to do this?
DDS=Direct Draw Surface, the TDirectDrawSurface can only load normal image types defined in Delphi (BMP,JPG, etc...) but not DDS files.
As DDS is a acronim DirectDrawSurface - loading DDS in DirectX7 is pretty easy. Just lock surface and copy data from file to locked memory (assuming both surface and DDS file have the same format)
DDS File Reference on MSDN
There are only 10 types of people in this world; those who understand binary and those who don't.
Ok, but how? I guess I have to read the DDS header to get the info and size of the data, right? That's why I asked for a sample, I have never worked with TDelphiX. Can't you give me a small sample.Originally Posted by Clootie
What should I do, these steps (or it is easier than that)?
1. Read Header,
2. Set TDirectDrawSurface info to the one in the header? (width, height,..)
3. Lock
4. Do a memcopy from file to mem
5. Unlock?
Can I just load the file into memory, and do a CreateSurface(TDDSurfaceDesc_DX6(memory))?
I have not touched DelphiX code for a really long time, so can't answear on DelphiX specific bits...
You can
1) read whole file in memory
2) alias DDSURFACEDESC2 pointer to 5-th byte of this memory
3) gather needed info for creating DirectDraw surface; create it
4) do Move(file_in_mem, memory_of_locked_directdraw_surface)
There are only 10 types of people in this world; those who understand binary and those who don't.
Bookmarks