Loading a tga file directly into openGL

Hello! I would like to know if there is any techniques that allow the loading of a tga file into an openGL scene. For example,I have to make a nature scene with a forest and I have tga files of different trees. Is there a way to put the picture file directly into the scene?

Read about texturing in OpenGL (there should be plenty of tutorials, for example ones from NeHe). You may be also interested in billboarding. As to tga loading, simple google search will give you some code.

Thanks! I didn’t know what I was looking for was called billboarding. :slight_smile:

TGA loading

Thanks for the link! But,I can’t understand everything in the Billboarding tutorial. Can anyone make it simpler for me? For example,if I just want the tga file to appear and not the snowman.

Please take a look at this:

It loads a TGA image and render it using glDrawPixels(). You can get better rendering performance by using OpenGL texture object. However, most images are not power of 2 (POT) in resolution, so, glDrawPixels() is much simpler for NPOT images.

You may use OpenGL extension, GL_ARB_texture_non_power_of_two, and GL_ARB_texture_rectangle if the video card supports them.
Here is an example to load NPOT images and render it as texture.