22 #ifndef BACKENDS_GRAPHICS3D_OPENGLSDL_GRAPHICS3D_H 23 #define BACKENDS_GRAPHICS3D_OPENGLSDL_GRAPHICS3D_H 25 #include "backends/graphics/sdl/sdl-graphics.h" 27 #include "math/rect2d.h" 29 #if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) 31 #include "graphics/opengl/context.h" 35 class SurfaceRenderer;
47 virtual ~OpenGLSdlGraphics3dManager();
55 int getDefaultGraphicsMode()
const override;
57 int getGraphicsMode()
const override;
60 int getDefaultStretchMode()
const override;
61 bool setStretchMode(
int mode)
override;
62 int getStretchMode()
const override;
64 void beginGFXTransaction()
override;
72 return supportedFormats;
75 int getScreenChangeID()
const override {
return _screenChangeCount; }
77 int16 getHeight()
const override;
78 int16 getWidth()
const override;
81 void updateScreen()
override;
83 void setPalette(
const byte *colors, uint start, uint num)
override {}
84 void grabPalette(byte *colors, uint start, uint num)
const override {}
85 void copyRectToScreen(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override {}
87 void unlockScreen()
override {}
88 void fillScreen(uint32 col)
override {}
89 void fillScreen(
const Common::Rect &r, uint32 col)
override {}
90 void setShakePos(
int shakeXOffset,
int shakeYOffset)
override {};
91 void setFocusRectangle(
const Common::Rect& rect)
override {}
92 void clearFocusRectangle()
override {}
95 void showOverlay(
bool inGUI)
override;
96 void hideOverlay()
override;
98 void clearOverlay()
override;
100 void copyRectToOverlay(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
101 int16 getOverlayWidth()
const override;
102 int16 getOverlayHeight()
const override;
105 bool showMouse(
bool visible)
override;
106 void setMouseCursor(
const void *buf, uint w, uint h,
int hotspotX,
int hotspotY, uint32 keycolor,
bool dontScale =
false,
const Graphics::PixelFormat *format = NULL,
const byte *mask = NULL)
override {}
107 void setCursorPalette(
const byte *colors, uint start, uint num)
override {}
110 void notifyVideoExpose()
override {};
111 void notifyResize(
const int width,
const int height)
override;
113 bool gameNeedsAspectRatioCorrection()
const override;
115 void showSystemMouseCursor(
bool visible)
override;
117 #if defined(USE_IMGUI) && SDL_VERSION_ATLEAST(2, 0, 0) 118 void *getImGuiTexture(
const Graphics::Surface &image,
const byte *palette,
int palCount)
override;
119 void freeImGuiTexture(
void *texture)
override;
123 #if SDL_VERSION_ATLEAST(2, 0, 0) 124 int _glContextProfileMask, _glContextMajor, _glContextMinor;
125 SDL_GLContext _glContext;
126 void deinitializeRenderer();
129 OpenGL::ContextType _glContextType;
131 bool _supportsFrameBuffer;
133 struct OpenGLPixelFormat {
139 int multisampleSamples;
141 OpenGLPixelFormat(uint screenBytesPerPixel, uint red, uint blue, uint green, uint alpha,
int samples);
150 bool createOrUpdateGLContext(uint gameWidth, uint gameHeight, uint effectiveWidth, uint effectiveHeight,
151 bool renderToFramebuffer,
bool engineSupportsArbitraryResolutions);
153 void createOrUpdateScreen();
156 void handleResizeImpl(
const int width,
const int height)
override;
168 bool _queuedScreenshot =
false;
169 void saveScreenshot()
override;
172 bool saveScreenshot(
const Common::Path &filename)
const override;
174 uint _engineRequestedWidth, _engineRequestedHeight;
176 int _screenChangeCount;
181 bool _lockAspectRatio;
189 void initializeOpenGLContext()
const;
193 OpenGL::FrameBuffer *_frameBuffer;
194 OpenGL::FrameBuffer *createFramebuffer(uint width, uint height);
195 bool shouldRenderToFramebuffer()
const;
199 enum TransactionMode {
200 kTransactionNone = 0,
201 kTransactionActive = 1,
202 kTransactionRollback = 2
208 TransactionMode _transactionMode;
211 #endif // defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
Definition: sdl-events.h:40
Definition: sdl-graphics.h:38
Feature
Definition: system.h:403
TransactionError
Definition: system.h:1155
Definition: renderbuffer.h:27
Definition: surfacerenderer.h:37
Definition: tiledsurface.h:40
Definition: sdl-window.h:30