Reading TGA files, using extensions
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.
[email=JValentine_13@hotmail.com]contact[/email]
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!]
[Resist Windows XP''s Invasive Production Activation Technology!]
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.
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.
[email=JValentine_13@hotmail.com]contact[/email]
My image format is extremely simple:
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:
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!]
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!]
heh, GL_BGR_EXT and GL_BGRA_EXT work great.... no need to swap red and blue bytes... just in case anyone cares...
Feel free to email me.
Feel free to email me.
[email=JValentine_13@hotmail.com]contact[/email]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement