Sign in to follow this  

Writing a TGA file..., New File format.

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

Well i took nehe's code and read threw on how to read and write compressed and uncompressed TGA files. Now all i want to do is add a block of information to the front of the file, before the actual TGA stuff. SO in turn i will give this new file its own extension so only my program can read the file. i need some extra info not stored in the tga. What is the best way to do this? Should i write a new function that reads however many bits/bytes from the file my extra info is, then pass it along to my TGA reading class, after the info is extracted, or should i write a whole new function? i guess i dont understand just blain reading and writing binary info, if anyone has some samples on thier own binary file, or something like what im talking about please help me.

Share this post


Link to post
Share on other sites
Alternatively you could make use of the developer area in the later tga spec. Wotsit has a couple of documents that describe this. This would allow you to view your tga's normally in any application but only your application would be able to make sense of the extra embedded info.

Share this post


Link to post
Share on other sites
Quote:
Original post by justinrwalsh
this is way over my head, maybe ill take a stab at it later


You could just store a .txt file like this:
file.tga "The info I want"
another.tga "Some more info"

That txt file should be in the same folder as your .tga's and you just parse it when you need info. The parsing should be trivial, check the filename - is it the one you want? yes=good, no=skip line - repeat. Creating is simple, just use notepad =P

If you still want to connect a file with some info, but without hacking the actual file =)

Share this post


Link to post
Share on other sites

This topic is 4812 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this