View unanswered posts | View active topics It is currently Thu Sep 09, 2010 2:07 pm



This section is under re-development. It is not finished, and not fully functional. The current development stage is pre-alpha and as such, not every feature is even implemented yet.




Options



rss Planet-Black0ps
rss Diagmato
rss Development



Users



Total entries:
Total comments:

Writing to TGA, mass image dumping

Diagmato, Development
Mon Oct 13, 2008 1:31 am
Started: 3rd October 2008

Last night, I worked on the TGA writing function. It only supports image type 2 at the moment (raw, uncompressed). To write to this format, we just need to setup the header with the necessary values (most are 0, except for image type, and the width and height, which are the values of the viewport (iViewport[2], iViewport [3]). Then after the header, we just write the image data, with the size obtained through the width * height * bytes per pixel (3 in this case). The image is read from the OpenGL Front buffer, which will gather the viewport rendering including both perspective and orthographic.

To take a screenshot, currently the controls are ctrl + right mouse click. But this will keep taking screenshots as long as they are both held down, and unless the person controlling it has the reflexes of an agent in The Matrix, they will get a number of files.

The save tga function does the work of checking for a unique file name. It iterates an integer, prefixes it to the filename, and tries to open it. If it successfully opened a file, then there is already a file with the name it is trying to use, so it increments the integer, and tries again until it fails to open a file, and thus creates and writes the new file. This makes it handy for dumping screenshots for exporting to a movie clip (with videomach for example). This needs to be improved – currently, the more screenshots there are, the longer it takes for it to search for the next filename iteration, and this quickly becomes noticable when the computer is trying the same process on every frame.


(first ever working screenshot using in-engine code)

Proposed Improvements

-Keep a record of the last successful iteration so that the computer does not need to test potentially 50 files just to save the next one, each frame.
-Add support for saving RLE-encoded tga's
-Add support for taking one screenshot, or a series of screenshots



Improved - 3rd October 2008

Texture class now remembers the last file number saved, so it only needs to check once if a file exists before writing it.


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.