loading image. Binary confusion

This is a discussion on loading image. Binary confusion within the C++ Programming forums, part of the General Programming Boards category; Ok, I'm trying write a simple tga loader. It's going to give openGL the information it needs to load the ...

  1. #1
    Allways learning cs_student's Avatar
    Join Date
    Aug 2008
    Location
    ~/
    Posts
    39

    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,

    cs_student

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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
    http://en.wikipedia.org/wiki/Truevision_TGA
    and another specification here:
    http://www.ludorg.net/amnesia/TGA_File_Format_Spec.html

    --
    Mats
    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
    Posts
    1,901
    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.
    Here to Deceive, Inveigle, Obfuscate Since 1945

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 Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. Replies: 4
    Last Post: 03-02-2003, 08:12 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21