-
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?
-
Senior Member
OpenGL Pro
Re: Loading a tga file directly into openGL
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.
-
Re: Loading a tga file directly into openGL
Thanks! I didn't know what I was looking for was called billboarding.
-
Advanced Member
Frequent Contributor
Re: Loading a tga file directly into openGL
-
Re: Loading a tga file directly into openGL
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.
-
Junior Member
Regular Contributor
Re: Loading a tga file directly into openGL
girish3110,
Please take a look at this:
imageTga.zip
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.
textureNPOT.zip
textureRectangle.zip
-
Re: Loading a tga file directly into openGL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules