🔒 Locked
Loading Textures
Advertisement
Original Post
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.
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]
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]
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.
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.
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.
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
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
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)
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...
It is dependent upon sdl and sdl_image...
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.
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.
Just one question: Why the **** should anyone use libraris for bitmap''s or targa''s when it''s soooo easy to write one yourself.??? It''s really not that hard, I mean take a look at some (official) papers describing the header and body and the rest is almost piece of cake! The only strange things is that bitmaps''s are organized in a row system with a 0x00 at the end of each vertical row and targa''s is organized in BGR (or BGRA) instead of RGB (or RGBA).
quote:
Original post by nife
Just one question: Why the **** should anyone use libraris for bitmap''s or targa''s when it''s soooo easy to write one yourself.??? It''s really not that hard, I mean take a look at some (official) papers describing the header and body and the rest is almost piece of cake! The only strange things is that bitmaps''s are organized in a row system with a 0x00 at the end of each vertical row and targa''s is organized in BGR (or BGRA) instead of RGB (or RGBA).

Sharp Basic - Coming summer 2004!
Sign Up For Sharp Basic Beta Testing!!!
errm, because they are there to be used?
Look at it this way, I could go out and code it but I dont want to, I''d much rather use a tried and tested lib and just drop it in my app then bother about it.
If you want to go out and reinvent the wheel all the fine, whatever, but personaly I prefer to do other stuff and use whats avalible to me than write everything again from the ground up, thus why I use all manner of libs such as image loading/saving, networking, STL and Boost.
Look at it this way, I could go out and code it but I dont want to, I''d much rather use a tried and tested lib and just drop it in my app then bother about it.
If you want to go out and reinvent the wheel all the fine, whatever, but personaly I prefer to do other stuff and use whats avalible to me than write everything again from the ground up, thus why I use all manner of libs such as image loading/saving, networking, STL and Boost.
I personally would like to create everything myself because i will be using this for a school project and probably in my own engine, also it is good to learn how to read in file formats, i have done some work with reading in files before but i still could use some work. The only reason i would stay away from libraries is because this should not be to hard to learn and it will help me in more ways than just texture loading, it will also help me with reading file formats.
-THACO
-THACO
meh, your choice but i cant help feel its a large waste of time, I mean where does it stop? "I wont use the STL because i want to do it myself", "I wont use a ready made scripting language coz i want to do it myself" and so on and so on.. *shrugs*
Unless they say ''you must recreate the wheel for everything'' then i dont see the issue with school work and the libs I use are all zlib/png licence stuff which is basicaly ''do what you like with it'', so no worries about including it in engines etc... still, *shrugs* do as you want...
Unless they say ''you must recreate the wheel for everything'' then i dont see the issue with school work and the libs I use are all zlib/png licence stuff which is basicaly ''do what you like with it'', so no worries about including it in engines etc... still, *shrugs* do as you want...
It is not so much recreating the wheel. Maybe he wants to learn it himself, u get 20 times more satisfaction if u can say "I made this" not "I did the gfx". Altho if u want to jus create not learn, use libs by all means. Hope u have fun with ur project THACO remember to use these sites as they are really useful:
Nehe
Game Tutorials
ultimate game programming
Go for it!
------------
"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 9, 2004 10:29:37 AM]
[edited by - Kris2456 on June 9, 2004 10:30:33 AM]
Nehe
Game Tutorials
ultimate game programming
Go for it!
------------
"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 9, 2004 10:29:37 AM]
[edited by - Kris2456 on June 9, 2004 10:30:33 AM]
quote:
Original post by Xarragon
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.
You can use the DXT texture compression (ie .DDS files) to store and use the textures. this is handy if you''ve got a load of large textures (my terrain engine uses 64 x 1024x1024 32 bit textures so it needs compression. other nice thing about this is that the DDS plugin for photoshop generates the mip maps for you as well so you get compression for all mipmap levels.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement