Otclient  14/8/2020
painterogl2.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #ifndef PAINTEROGL2_H
24 #define PAINTEROGL2_H
25 
26 #define PAINTER_OGL2
27 
28 #include "painterogl.h"
29 
35 class PainterOGL2 : public PainterOGL
36 {
37 public:
38  PainterOGL2();
39 
40  void bind();
41  void unbind();
42 
43  void drawCoords(CoordsBuffer& coordsBuffer, DrawMode drawMode = Triangles);
44  void drawFillCoords(CoordsBuffer& coordsBuffer);
45  void drawTextureCoords(CoordsBuffer& coordsBuffer, const TexturePtr& texture);
46  void drawTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
47  void drawUpsideDownTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
48  void drawRepeatedTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
49  void drawFilledRect(const Rect& dest);
50  void drawFilledTriangle(const Point& a, const Point& b, const Point& c);
51  void drawBoundingRect(const Rect& dest, int innerLineWidth = 1);
52 
53  void setDrawProgram(PainterShaderProgram *drawProgram) { m_drawProgram = drawProgram; }
54 
55  bool hasShaders() { return true; }
56 
57 private:
58  PainterShaderProgram *m_drawProgram;
59  PainterShaderProgramPtr m_drawTexturedProgram;
60  PainterShaderProgramPtr m_drawSolidColorProgram;
61 };
62 
64 
65 #endif
PainterOGL2::unbind
void unbind()
Definition: painterogl2.cpp:59
PainterOGL2::drawFillCoords
void drawFillCoords(CoordsBuffer &coordsBuffer)
Definition: painterogl2.cpp:123
painterogl.h
PainterOGL2::drawFilledTriangle
void drawFilledTriangle(const Point &a, const Point &b, const Point &c)
Definition: painterogl2.cpp:191
TRect< int >
PainterOGL2::PainterOGL2
PainterOGL2()
Definition: painterogl2.cpp:29
Painter::DrawMode
DrawMode
Definition: painter.h:46
PainterOGL2::hasShaders
bool hasShaders()
Definition: painterogl2.h:55
PainterOGL2::drawTexturedRect
void drawTexturedRect(const Rect &dest, const TexturePtr &texture, const Rect &src)
Definition: painterogl2.cpp:140
PainterOGL2::drawCoords
void drawCoords(CoordsBuffer &coordsBuffer, DrawMode drawMode=Triangles)
Definition: painterogl2.cpp:66
PainterOGL2::drawTextureCoords
void drawTextureCoords(CoordsBuffer &coordsBuffer, const TexturePtr &texture)
Definition: painterogl2.cpp:130
PainterOGL2::drawUpsideDownTexturedRect
void drawUpsideDownTexturedRect(const Rect &dest, const TexturePtr &texture, const Rect &src)
Definition: painterogl2.cpp:153
PainterOGL2::drawFilledRect
void drawFilledRect(const Rect &dest)
Definition: painterogl2.cpp:179
Painter::Triangles
@ Triangles
Definition: painter.h:47
PainterOGL2::drawRepeatedTexturedRect
void drawRepeatedTexturedRect(const Rect &dest, const TexturePtr &texture, const Rect &src)
Definition: painterogl2.cpp:166
PainterOGL2
Definition: painterogl2.h:35
PainterOGL2::bind
void bind()
Definition: painterogl2.cpp:49
PainterShaderProgram
Definition: paintershaderprogram.h:30
PainterOGL2::drawBoundingRect
void drawBoundingRect(const Rect &dest, int innerLineWidth=1)
Definition: painterogl2.cpp:203
stdext::shared_object_ptr< Texture >
CoordsBuffer
Definition: coordsbuffer.h:29
TPoint< int >
PainterOGL2::setDrawProgram
void setDrawProgram(PainterShaderProgram *drawProgram)
Definition: painterogl2.h:53
PainterOGL
Definition: painterogl.h:28
g_painterOGL2
PainterOGL2 * g_painterOGL2
Definition: painterogl2.cpp:27