ScummVM API documentation
graphics-opengl-base.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_BASE_H
23 #define ALCACHOFA_GRAPHICS_OPENGL_BASE_H
24 
25 // This file shall not use any OpenGL API surface or include headers related to it
26 
27 #include "alcachofa/graphics.h"
28 
29 namespace Alcachofa {
30 
31 class OpenGLRendererBase : public virtual IRenderer {
32 public:
34 
35  bool hasOutput() const override;
36 
37 protected:
38  virtual void setViewportInner(int x, int y, int width, int height) = 0;
39  virtual void setMatrices(bool flipped) = 0;
40 
41  void resetState();
42  void setViewportToScreen();
43  void setViewportToRect(int16 outputWidth, int16 outputHeight);
44  void getQuadPositions(Math::Vector2d topLeft, Math::Vector2d size, Math::Angle rotation, Math::Vector2d positions[]) const;
45  void getQuadTexCoords(Math::Vector2d texMin, Math::Vector2d texMax, Math::Vector2d texCoords[]) const;
46 
47  Common::Point _resolution, _outputSize;
48  Graphics::Surface *_currentOutput = nullptr;
49  BlendMode _currentBlendMode = (BlendMode)-1;
50  float _currentLodBias = 0.0f;
51  bool _isFirstDrawCommand = false;
52 };
53 
54 }
55 
56 #endif // ALCACHOFA_GRAPHICS_OPENGL_BASE_H
Definition: alcachofa.h:45
Definition: surface.h:67
Definition: graphics.h:74
Definition: rect.h:144
Definition: graphics-opengl-base.h:31