Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

THACO

Loading Textures

This topic is 5219 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am curious what best format would be to use for textures. I would use textures for sprites and also texture mapping on 3d objects, Should i use .bmp .tga .jpeg. Also I see at the tutorials at NeHe they use the GLaux for loading of bmps and i was looing around the internet and saw that glaux is old and unsupported because of some flaws and memory leaks. Are there any other tutorials or functions to use, are there functions in GLUT to help with loading of textures? -THACO p.s. i use eclipse with c++ and when i include the glaux library the exe will not run because it cannot find glaux.dll i can still compile using LCC compiler instead of mingw but its a pain.

Share this post


Link to post
Share on other sites
Advertisement
out of all those .TGA is the best. It supports the ALPHA channel, which is really handy (They hav to be 32bit tho). Use Photoshop or PSP for those. Also, for a nice .TGA loader. Nip over to www.gametutorials.com for a really neat .tga loader.

As for GLUT i dontuse it, so i wudnt know...


------------

"Here lies a toppled God,
His fall was not a small one,
We but built his pedastle,
A narrow, and a tall one"
Frank Herbert (Dune:Messiah)

[edited by - Kris2456 on June 7, 2004 5:55:19 PM]

Share this post


Link to post
Share on other sites
Why don''t you just write a graphics library that reads and writes to all of those formats? You can get a lot of information online, and if you aren''t sure what you want to use, just support them all.

Share this post


Link to post
Share on other sites
If you don''t need an alpha channel, use bmp 8 bit.
256 colors/texture is more than enough, the size is smaller than 16/32 TGA (uncompressed TGA), and there is no image loss.
JPG is a bad idea, since you might want to use texture compression, in which case the quality would be further degraded.

Share this post


Link to post
Share on other sites
That sounds good,thanks Raduprv for reminding me about 8 bit bmps that is a good idea.
Kris thanks for the link that will be very helpful
sirSolarius i would like to do that because the more the better but if there are certain reason for certain formats its always good to know the proper time to use formats

-THACO

Share this post


Link to post
Share on other sites
I vote for PNG, since it''s losslessly compressable (ah, English...) and supports a full alpha channel as well.

If you use SDL as your foundation, you can load in any filetype using SDL_image. There''s no reason to write your own file loading library if it''s already been done.

Share this post


Link to post
Share on other sites
Just decide on a format, and make your own loading function.
My BMP loading function is about 60 lines of C. I made it in a few hours. There is no need to have additional dependencies for loading a texture.

Share this post


Link to post
Share on other sites
or use one of the many libraries out there, such as FreeImage, Corona and DevIL (too tired to get links, search sourceforge.net for details)

Share this post


Link to post
Share on other sites
In my recent post about color keying I posted a function which can load in bmp, jpg, gif, png, and tga and convert it to an opengl texture. It also can color key the texture if you want.
It is dependent upon sdl and sdl_image...

Share this post


Link to post
Share on other sites
Well, in the end, OpenGL always want pure RGB/RGBA data, so whatever format you use, you must decompress it into this. This might hoever be different if you use texture compression, but I couldn''t tell for sure.

TGA is, as said, a good format, since it has alpha, and can be saved to by many programs. If you use uncompressed TGA''s, the code to load it is really simple as well.

In my opinion, the best method is to use some library, just as leiavoia said. As long as you get your RGB/RGBA data in the end, you can use anything.
The only problem is, as always to get people to download the library (unless you link it statically, or can bundle it with your package).

Some people use uncompressed image formats, and then compress all data with a general-purpose algorithm. The drawback to this is that the compression ratio is likely to be less efficient for image data, compared to that of a image-specific algorithm.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!