openMSX
SDLGLOutputSurface.hh
Go to the documentation of this file.
1 #ifndef SDLGLOUTPUTSURFACE_HH
2 #define SDLGLOUTPUTSURFACE_HH
3 
4 #include "GLUtil.hh"
5 #include "MemBuffer.hh"
6 #include <string>
7 
8 namespace openmsx {
9 
10 class OutputSurface;
11 
12 /** This is a common base class for SDLGLVisibleSurface and
13  * SDLGLOffScreenSurface. Its only purpose is to have a place to put common
14  * code.
15  */
16 class SDLGLOutputSurface
17 {
18 public:
19  /** These correspond respectively with the renderers:
20  * SDLGL-PP, SDLGL-FB16, SDLGL-FB32
21  */
22  enum FrameBuffer { FB_NONE, FB_16BPP, FB_32BPP };
23 
24  FrameBuffer getFrameBufferType() const { return frameBuffer; }
25 
26 protected:
27  explicit SDLGLOutputSurface(FrameBuffer frameBuffer = FB_NONE);
28  ~SDLGLOutputSurface() = default;
29 
30  void init(OutputSurface& output);
31  void flushFrameBuffer(unsigned width, unsigned height);
32  void clearScreen();
33  void saveScreenshot(const std::string& filename,
34  const OutputSurface& output) const;
35 
36 private:
37  float texCoordX, texCoordY;
38  gl::Texture fbTex;
39  MemBuffer<char> fbBuf;
40  const FrameBuffer frameBuffer;
41 };
42 
43 } // namespace openmsx
44 
45 #endif