Thread: TGA file top-down or not?

  1. #1
    Registered User pronecracker's Avatar
    Join Date
    Oct 2006
    Location
    netherlands
    Posts
    158

    TGA file top-down or not?

    I'm loading a top-down TGA file, took me a while to figure out how to tell CreateDIBitmap that it's top-down. Now I'm realizing I could both support top-down and bottom-up files, the only thing is that I don't know where in the file it's specified whether it's top-down.

    At offset 8 there are two WORDs indicating the 'origin' of the image, but they're not used in a bottom-up TGA, neither in a top-down one.

  2. #2
    Registered User pronecracker's Avatar
    Join Date
    Oct 2006
    Location
    netherlands
    Posts
    158
    Sorry never mind I already found it. I just read over it. In case you want to know, http://www.gamers.org/dEngine/quake3/TGA.txt

  3. #3
    Registered User pronecracker's Avatar
    Join Date
    Oct 2006
    Location
    netherlands
    Posts
    158
    Solution:

    • Take the byte at offset 17 (let's call it cImageDescriptor)
    • bool bTopDown = cImageDescriptor & 32;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. ordered linked list
    By redmondtab in forum C Programming
    Replies: 48
    Last Post: 10-22-2006, 06:09 AM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM