render_to_png.h 782 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef IGL_RENDER_TO_PNG_H
  2. #define IGL_RENDER_TO_PNG_H
  3. #include <igl/igl_inline.h>
  4. #include <string>
  5. namespace igl
  6. {
  7. //
  8. // Render current open GL image to .png file
  9. // Inputs:
  10. // png_file path to output .png file
  11. // width width of scene and resulting image
  12. // height height of scene and resulting image
  13. // alpha whether to include alpha channel
  14. // fast sacrifice compression ratio for speed
  15. // Returns true only if no errors occured
  16. //
  17. // See also: igl/render_to_tga which is faster but writes .tga files
  18. IGL_INLINE bool render_to_png(
  19. const std::string png_file,
  20. const int width,
  21. const int height,
  22. const bool alpha = true,
  23. const bool fast = false);
  24. }
  25. #ifdef IGL_HEADER_ONLY
  26. # include "render_to_png.cpp"
  27. #endif
  28. #endif