Jump to content

How to save the backbuffer to file?


ccss
 Share

Recommended Posts

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

Link to comment
Share on other sites

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...

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

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! 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...