Game Development Community

Take a snapshot in TGB

by Nir Ziso · in Torque Game Builder · 10/30/2006 (12:15 am) · 11 replies

In look in the Tdn for this function
screenshot("capture0.png", "PNG" );
i try to use it but its not work why?

#1
10/30/2006 (7:17 pm)
Is it error or what??
i think your snapshot is kept on screenshot folder
#2
10/30/2006 (7:25 pm)
Hmm try this
screenShot("./a.jpg","JPEG");
the screenshot is kept on torquegamebuilder\games folder
#3
10/31/2006 (4:15 am)
The engine crashed
#4
11/04/2006 (4:45 am)
So if you use
screenShot("./a.jpg","JPEG");
the engine get crasheD?
#5
08/05/2007 (3:43 am)
Hi,

I have tried to use it but don't work. The file is created but incorrectly, so when you try to open it I got a deformed image of the screen.
#6
08/05/2007 (4:49 am)
Use this :

%Screenshot = "~/save/ImageForShot.png";
%Screenshot = expandFilename(%Screenshot);
Screenshot(%Screenshot, "png");
#7
08/05/2007 (7:33 am)
Thanks for response Daniel,

I tried the code that you post, but I still have the same problem. In both cases (your code and mine) the file is created but if you see the image its appear with a distorsion, like it would was incorrectly saved, I tried with 2 formats (JPG and PNG) and I had the same problem. I'm using TGB 1.5.
#8
08/05/2007 (1:56 pm)
If your first image comes out distorted try a second one immediately after that. I sometimes have the issue of the first image taken since the apps started being distorted.
#9
08/05/2007 (2:24 pm)
Thanks Matthew,

I have tried that but I have the same problem, how can I post a file so you can look my problem?

Thanks anyway...
#10
08/07/2007 (6:36 pm)
Pedro,

Try calling the screenshot from a schedule. I had to do this to avoid getting partial screenshots and distortion problems. It seems that if you have a lot going on in game while doing the screenshot, weird things happen. Almost like the framebuffer is halfway through getting updated when the screenshot is taken. I have found using a schedule fixes the problem.

Brian
#11
08/14/2007 (9:48 am)
Hi Brian,

Thanks for your response, I don't know what a schedule is but I'm sure that reading the docs I'll find that. I'll try and write here if it's work or dont.

Thanks again,

Pedro.