ccss Posted May 19, 2017 Share Posted May 19, 2017 I need to create a series of still images from inside my game project. I can't seemed to find any api commands (lua) that would allow me to do this. There is the Context.Screenshot() function, but calling this function will immediately end the game and open up a steam page. How can I grab a screen rendering and save it to disk via Lua? Thanks Quote Link to comment Share on other sites More sharing options...
ccss Posted May 27, 2017 Author Share Posted May 27, 2017 Anyone?? Hello? Is there no way to Grab the screen/ backbuffer from lua and save to a file? Quote Link to comment Share on other sites More sharing options...
macklebee Posted May 27, 2017 Share Posted May 27, 2017 On 5/19/2017 at 5:29 PM, ccss said: I need to create a series of still images from inside my game project. I can't seemed to find any api commands (lua) that would allow me to do this. There is the Context.Screenshot() function, but calling this function will immediately end the game and open up a steam page. How can I grab a screen rendering and save it to disk via Lua?Thanks Just perform the context:Screenshot() based on a key hit - because it does not immediately end a game. if window:KeyHit(Key.P) then context:Screenshot("c:/screenshots/image_"..Time:GetCurrent()..".tga") end Run your game's executable and not through the editor if you don't want a steam pics page to open after the game closes - of course, do not initialize steam in your game either... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
ccss Posted May 28, 2017 Author Share Posted May 28, 2017 Thanks for the reply! Running the exported game fixed my issue. I removed all the calls to steam from my main script, but it still shows up. Not sure where it's coming from. Quote Link to comment Share on other sites More sharing options...
macklebee Posted May 28, 2017 Share Posted May 28, 2017 If you are running it through the editor then steam will be initialized even without it in the main script, and the steam pics page will show up since the LE editor is a steam "game". Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
ccss Posted May 28, 2017 Author Share Posted May 28, 2017 Thanks. That makes sense. In case anyone else has this issue in the future. I'll note that my game was closing because of a quiet exception from calling the Screenshot function at the end of the render function. By moving the call to Screenshot into PostRender. It fixed the issue. Thanks again for the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.