Thread: Loading TARGA with OpenGL

  1. #1
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104

    Loading TARGA with OpenGL

    Hello.
    I allready have a premade function to load TARGA files for me, from files on the disk.

    The function works with the TARGA using the following:
    FILE file=Open(thefilename);

    I want to load it from the resource instead, without to change the FILE type, so i dont need to change the whole function.

    So to be clear: Can someone show me a example of how to load a TARGA file from the resource which is added with your program, into a FILE variable?

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    I don't think you can load TGAs from a resource, only bitmaps. See nehe.gamedev.net on how to do that. Otherwise, if you didn't change the 'type' you are just loading a .tga renamed to a resource file type.
    See you in 13

  3. #3
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    would either of you explain what you mean by the resource?

  4. #4
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104
    Sure..
    The resource-script which is compiled together with the program!
    Like the place where dialogboxes, icons, and stringtables are placed!

    I KNOW it is possible to add a TARGA file into the resource.
    What i want to know, is how to use the TARGA inside the resource , like a normal TARGA, loaded from a other file.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    How do you KNOW it is possible? I haven't heard of it before, only bitmaps.
    See you in 13

  6. #6
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104
    Because I have bought and read Programming Windows Fifth Edition, by Charles Petzold, "The difinitive guide to the Win32 API".

    You can for example do this to include a TARGA file in your resource script:
    Code:
    MYCUSTOMRESOURCE   TARGA    DISCARDABLE  "mytarga.tga"

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    580
    Wait, and it doesn't tell you how to load the tga file? I honestly don't know how to load a tga from a resource.
    See you in 13

  8. #8
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    OH that file! The MSDN will tell you if you can or cannot do it, which I'm pretty sure you can put anything you want into a resource file. Type "resource file" into the help index.

  9. #9
    Politics&Cpp geek Da-Nuka's Avatar
    Join Date
    Oct 2004
    Posts
    104
    Thats right, I can add whatever filesize and format i want into the resource. What I want to know is how to actually USE TARGA, when it is a resource.

  10. #10
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    Right, and the MSDN will tell you how to do that. The resource file doesn't do anything special to the file, it just packs them all together. If you know how to get to the file in the resource file, it's just the same as it being a seperate file. Perhaps I don't understand your question correctly?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  2. OpenGL Again, Loading Textures onto Quads
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 05-07-2005, 08:14 PM
  3. Loading an image into memory using OpenGL
    By Kaelin in forum C++ Programming
    Replies: 3
    Last Post: 02-08-2005, 12:03 PM
  4. OpenGL, loading BMP Textures?
    By Zeusbwr in forum Game Programming
    Replies: 12
    Last Post: 12-09-2004, 05:16 PM
  5. Loading a Bitmap resource for OpenGL Texture[x]
    By the dead tree in forum Game Programming
    Replies: 4
    Last Post: 08-26-2004, 01:12 PM