ReadbackTest.bv.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ----------------------------------------------------------------------------------------------------
  2. --
  3. -- Copyright (c) Contributors to the Open 3D Engine Project.
  4. -- For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. --
  6. -- SPDX-License-Identifier: Apache-2.0 OR MIT
  7. --
  8. --
  9. --
  10. ----------------------------------------------------------------------------------------------------
  11. g_screenshotOutputFolder = ResolvePath('@user@/Scripts/Screenshots/Readback')
  12. Print('Saving screenshots to ' .. NormalizePath(g_screenshotOutputFolder))
  13. OpenSample('RPI/Readback')
  14. SelectImageComparisonToleranceLevel("Level H")
  15. SetShowImGui(false)
  16. -- First capture at 512x512
  17. ResizeViewport(512, 512)
  18. SetImguiValue('Width', 512)
  19. SetImguiValue('Height', 512)
  20. IdleFrames(1)
  21. SetImguiValue('Readback', true)
  22. IdleFrames(5)
  23. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_1.png')
  24. IdleFrames(1)
  25. -- Then at 1024x1024
  26. ResizeViewport(1024, 1024)
  27. SetImguiValue('Width', 1024)
  28. SetImguiValue('Height', 1024)
  29. IdleFrames(1)
  30. SetImguiValue('Readback', true)
  31. IdleFrames(5)
  32. CaptureScreenshot(g_screenshotOutputFolder .. '/screenshot_2.png')
  33. IdleFrames(1)
  34. SetShowImGui(true)
  35. OpenSample(nil)