ScummVM API documentation
graphics-opengl.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ALCACHOFA_GRAPHICS_OPENGL_H
23 #define ALCACHOFA_GRAPHICS_OPENGL_H
24 
25 #include "alcachofa/graphics-opengl-base.h"
26 
27 #include "graphics/managed_surface.h"
28 #include "graphics/opengl/system_headers.h"
29 #include "graphics/opengl/debug.h"
30 
31 namespace Alcachofa {
32 
33 class OpenGLTexture : public ITexture {
34 public:
35  OpenGLTexture(int32 w, int32 h, bool withMipmaps);
36  ~OpenGLTexture() override;
37 
38  inline GLuint handle() const { return _handle; }
39  void setMirrorWrap(bool wrap);
40  void update(const Graphics::Surface &surface) override;
41 
42 protected:
43  bool _withMipmaps;
44  bool _mirrorWrap = true;
45  GLuint _handle = 0;
46 };
47 
49 public:
50  OpenGLRenderer(Common::Point resolution);
51 
52  Common::ScopedPtr<ITexture> createTexture(int32 w, int32 h, bool withMipmaps) override;
53  Graphics::PixelFormat getPixelFormat() const override;
54  bool requiresPoTTextures() const override;
55  void end() override;
56  void setOutput(Graphics::Surface &output) override;
57 
58 protected:
59  void setViewportInner(int x, int y, int width, int height) override;
60  void setBlendFunc(BlendMode blendMode);
61  void checkFirstDrawCommand();
62 
63  OpenGLTexture *_currentTexture = nullptr;
64 };
65 
66 }
67 
68 #endif // ALCACHOFA_GRAPHICS_OPENGL_H
Definition: alcachofa.h:45
Definition: graphics-opengl.h:48
Definition: surface.h:67
Definition: graphics-opengl.h:33
Definition: pixelformat.h:138
Definition: ptr.h:572
Definition: graphics.h:60
Definition: rect.h:144
Definition: graphics-opengl-base.h:31