Printing

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Printing

Post by aheymann »

Hallo

How does one print a scene (view) generated in Irrlicht?

Thanks

Anton Heymann
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

If you mean a screenshot, then (presumably triggered by receiving an event):

Code: Select all

                IImage * screenShot = device->getVideoDriver()->createScreenShot();
                if (screenShot)
                {
                    stringc name;
                    name = "screenshots/screenshot-";
                    name += device->getTimer()->getRealTime();
                    name += ".jpg";

                    device->getVideoDriver()->writeImageToFile(screenShot, name.c_str());
                    screenShot->drop();
                }
Just change the file suffix to have it saved in different formats.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Either that or just press the 'print screen' button on your keyboard which copies the screen contents onto the clipboard and then paste it into your most favouritest image editor to save it to a file.

Quicker to get a single screenshot as it doesn't require adding code but if you're going to want to do multiple screenshots in one run of your app then i'd suggest doing what rogerborg said!
Image Image Image
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Hallo

I do mean printing, as per File\Print. Is it possible to get a normal Windows GDI pointer to a irrlicht device. If that is possible, the printing should be a breeze.

Thanks

Anton
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

u can take the screenshot image, and create a GDC and a context for it, load it into the context and print that?
aheymann
Posts: 153
Joined: Wed Aug 22, 2007 12:25 pm
Location: England

Post by aheymann »

Roger

I assume the engine supports saving to TARGA files. That does then mean I can use something like Dave's TARGA animator (or something better if you know about it), to create AVI's. I can create an animation and take screen shots at regular intervals to create a series of files.

Thanks

Anton
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Yes, TARGA is supported: just pass a filename with a .tga suffix to writeImageToFile(), and it does it automagically.

I'm not sure what frame rate you'll be able to sustain while dumping that amount of data to the filesystem, but the only way to find out is to suck it and see. ;)
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
stephaneR
Posts: 12
Joined: Fri Mar 28, 2008 9:10 pm

Post by stephaneR »

well, the issue with printing is that the resolution of a printer area is far bigger than the rendered area, so if you do a screenshot of the existing view and print it, you will have either a very small image or if your resize it, it may be ugly.

i know very few of irrlicht (just beginning with it) but what I've done before in pre OpenGL is to re-render the scene offscreen in a new area with the resolution given by the printer driver and send the rendered image (as screenshot) to the printer.
no idea if it is possible with irrlicht and how.

just my $0.02

Stephane
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It's only possible for Direct3D, because the OpenGL RTTs are currently not lockable.
Post Reply