Taking a Screenshot
Steven Sell edited this page Jun 14, 2016
·
5 revisions
Taking a screenshot involves three short steps:
-
Retrieve Camera to Capture
auto camera = OcularCameras->getMainCamera();
-
Refresh the Camera's Render Texture
auto renderTexture = camera->getRenderTexture(); renderTexture->refresh();
-
Save the Render Texture to a File
OcularResources->saveResource(renderTexture, File("screenshot.png"));
All together:
auto camera = OcularCameras->getMainCamera();
if(camera)
{
auto renderTexture = camera->getRenderTexture();
if(renderTexture)
{
renderTexture->refresh();
OcularResources->saveResource(renderTexture, File("screenshot.png"));
}
}