SDLGLOffScreenSurface.cc 980 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "SDLGLOffScreenSurface.hh"
  2. #include "SDLGLVisibleSurface.hh"
  3. #include "GLUtil.hh"
  4. namespace openmsx {
  5. SDLGLOffScreenSurface::SDLGLOffScreenSurface(const OutputSurface& output)
  6. : fboTex(true) // enable interpolation TODO why?
  7. {
  8. calculateViewPort(output.getLogicalSize(), output.getPhysicalSize());
  9. auto [w, h] = getPhysicalSize();
  10. fboTex.bind();
  11. glTexImage2D(GL_TEXTURE_2D, // target
  12. 0, // level
  13. GL_RGB8, // internal format
  14. w, // width
  15. h, // height
  16. 0, // border
  17. GL_RGB, // format
  18. GL_UNSIGNED_BYTE, // type
  19. nullptr); // data
  20. fbo = gl::FrameBufferObject(fboTex);
  21. fbo.push();
  22. setOpenGlPixelFormat();
  23. }
  24. void SDLGLOffScreenSurface::saveScreenshot(const std::string& filename)
  25. {
  26. SDLGLVisibleSurface::saveScreenshotGL(*this, filename);
  27. }
  28. } // namespace openmsx