Results 1 to 6 of 6

Thread: Load DDS into a surface

  1. #1

    Load DDS into a surface

    I need a sample of how to load a DDS into a surface. Anyone has a sample on how to do this?

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Load DDS into a surface

    You'll probably need to provide a little bit more information... ie. Whats a DDS? and What kind of surface you're using?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    Load DDS into a surface

    DDS=Direct Draw Surface, the TDirectDrawSurface can only load normal image types defined in Delphi (BMP,JPG, etc...) but not DDS files.

  4. #4

    Load DDS into a surface

    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.

  5. #5

    Load DDS into a surface

    Quote Originally Posted by Clootie
    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
    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.

    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))?

  6. #6

    Load DDS into a surface

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •