Jump to content
  • Advertisement

Archived

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

Lord Karnus

Reading TGA files, using extensions

This topic is 6166 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

Just wondering which is better : to load a tga then swap the red/blue bits, or to leave them as they are and use GL_BGRA_EXT in glTexImage2d? Do all (or at least a vast majority of) video cards/drivers support GL_BGR_EXT and GL_BGRA_EXT? I''m not too familiar with these, and wondered why I should swap bits if it''s not necessary? Any help or suggestions would be greatly appreciated. Feel free to email me.

Share this post


Link to post
Share on other sites
Advertisement
Why don''t you just test and see? If you don''t want to do that, just swap them for portability. You only have to load each texture at load time, so it''s not much of a problem. Or, you can create your own image format that''s geared to be loaded as quickly as possible (well, at least I didn''t worry about file size, since mine are compressed in a package anyway).

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites
Describe your image format, if you would. I''m writing a small Texture-Manager/Image lib for my projects (to avoid any external .dlls and eccentric licensing restrictions) So far I only plan support for .tga, .jpg, .bmp, and .png. I don''t think that a project (unless it''s an image editor) needs support for 100s of formats!
How does your compressed archives work? I''ve set this up for the inclusion of the ability to load from archives, but that''s a boat I''ve not boarded yet.


Feel free to email me.

Share this post


Link to post
Share on other sites
My image format is extremely simple:

Header (Offset 0):
Width (4 Bytes), Height (4 Bytes), Offset of Data (4 Bytes), Bytes Per Pixel (4 Bytes).

Data (Offset specified in Header):
Image data...

I put the offset variable in there for possible ''modified'' image files.

The package files use ZLib (http://www.gzip.org/zlib) to handle compression and decompression of data. Their format looks like this:

Header (Offset 0):
Number of Items (4 Bytes), Offset of First Item (4 Bytes), Size of Item Headers.

Item (Offset depends):
Size of Decompressed Data (4 Bytes), Size of Compressed Data (4 Bytes), Size of Name (4 Bytes). Compressed Data (Size in Item Header).

Repeat...

When I "open" the file the offsets of every item, and each item''s name, is cached along with the file being left open. When I want the data of a specific item, I jump to the offset of that item, read it and decompress it.

[Resist Windows XP''s Invasive Production Activation Technology!]

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!