OpenGL; Using TGA Textures

This is a discussion on OpenGL; Using TGA Textures within the Game Programming forums, part of the General Programming Boards category; I've been following the NeHe OpenGL tutorials and have gotten as far as loading TGA images and converting them to ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    OpenGL; Using TGA Textures

    I've been following the NeHe OpenGL tutorials and have gotten as far as loading TGA images and converting them to textures. Everything goes well - the loader works fine - but I don't know how to actually make use of the texture.

    I can't use glBindTexture (GL_TEXTURE_2D, Textures[0]); because the second argument isn't a GLuint (it's a user defined struct "TGAImage").

    The most annoying thing is he's shown you how to load the TGA but not how to use it - can anyone help me?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    you can use allegrogl to load a tga and then 'allegro_gl_make_texture()' to convert into GLuint .
    Niara

  3. #3
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Thanks I'll have a look at that now.
    Are there any other options or is allegrogl my best bet?
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  4. #4
    ---
    Join Date
    May 2004
    Posts
    1,379
    OpenIL AKA DevIL library is an easy cross platform option.

  5. #5
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    >because the second argument isn't a GLuint (it's a user defined struct "TGAImage").

    You need to pass the GLUint returned as the second argument of glGenTextures(). You'll need to store that in your struct if its not there already.

  6. #6
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Thanks I've figured it out now
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  7. #7
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Just to let you (and anyone else having similar problems to me) OpenIL is the path I would recommend. Really easy to setup (I copied the libs / headers to my OpenGL dirs for clarity) and using the library is really easy to pick up. If anyone needs a start: http://gpwiki.org/index.php/DevIL:Tutorials:Basics

    Thanks for that sand_man
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. openGL: textures, gluLookAt, and undefined behavior
    By MK27 in forum Game Programming
    Replies: 7
    Last Post: 04-28-2009, 11:12 AM
  2. Multiple textures in OpenGL...
    By yaya in forum Game Programming
    Replies: 1
    Last Post: 02-12-2008, 08:24 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  4. OpenGL, loading BMP Textures?
    By Zeusbwr in forum Game Programming
    Replies: 12
    Last Post: 12-09-2004, 05:16 PM
  5. OpenGL / Moveing textures?
    By Oluf in forum Game Programming
    Replies: 7
    Last Post: 06-08-2004, 02:26 PM

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