Thread: loading image. Binary confusion

  1. #1
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008

    loading image. Binary confusion

    Ok, I'm trying write a simple tga loader. It's going to give openGL the information it needs to load the texture.

    I understand that it has a header which verifies the contents (ie that it is a tga file).

    The next part of the file is variable.

    Then you get the the image file itself, which consists of R, G, B, A values. (are the alpha values there too)?

    How do I know where this starts and ends.

    Also how can I tell if it's 32bit or 16 bit?

    Thanks you for your time and effort,


  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    The TGA format is not very complicated, but it's not entirely trivial either. There are links to some of the TGA format specifications on
    and another specification here:

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    There are frameworks like GLFW that load TGA's. If you really want to learn it's inner workings then go off the file spec, if you want to know all you need to to use it, learn about the header and just using a file handler in C++ that will load it for you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Loading an image in from a resource file
    By starcatcher in forum C++ Programming
    Replies: 4
    Last Post: 04-15-2008, 06:44 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Replies: 4
    Last Post: 03-02-2003, 09:12 AM