Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/Internals/OpenGLTextProgram.h @ 592:bbe29efd3d1c
OpenGLLinesProgram
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 26 Apr 2019 12:55:43 +0200 |
parents | |
children | 2d8ab34c8c91 |
comparison
equal
deleted
inserted
replaced
591:b66ced2c43d4 | 592:bbe29efd3d1c |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "../../Fonts/GlyphTextureAlphabet.h" | |
25 #include "../../OpenGL/IOpenGLContext.h" | |
26 #include "../../OpenGL/OpenGLProgram.h" | |
27 #include "../../OpenGL/OpenGLTexture.h" | |
28 #include "../../Toolbox/AffineTransform2D.h" | |
29 #include "../TextSceneLayer.h" | |
30 | |
31 namespace OrthancStone | |
32 { | |
33 namespace Internals | |
34 { | |
35 class OpenGLTextProgram : public boost::noncopyable | |
36 { | |
37 public: | |
38 class Data : public boost::noncopyable | |
39 { | |
40 private: | |
41 OpenGL::IOpenGLContext& context_; | |
42 size_t coordinatesCount_; | |
43 GLuint buffers_[2]; | |
44 float red_; | |
45 float green_; | |
46 float blue_; | |
47 double x_; | |
48 double y_; | |
49 double border_; | |
50 unsigned int textWidth_; | |
51 unsigned int textHeight_; | |
52 BitmapAnchor anchor_; | |
53 | |
54 public: | |
55 Data(OpenGL::IOpenGLContext& context, | |
56 const GlyphTextureAlphabet& alphabet, | |
57 const TextSceneLayer& layer); | |
58 | |
59 ~Data(); | |
60 | |
61 bool IsEmpty() const | |
62 { | |
63 return coordinatesCount_ == 0; | |
64 } | |
65 | |
66 size_t GetCoordinatesCount() const | |
67 { | |
68 return coordinatesCount_; | |
69 } | |
70 | |
71 GLuint GetSceneLocationsBuffer() const; | |
72 | |
73 GLuint GetTextureLocationsBuffer() const; | |
74 | |
75 float GetRed() const | |
76 { | |
77 return red_; | |
78 } | |
79 | |
80 float GetGreen() const | |
81 { | |
82 return green_; | |
83 } | |
84 | |
85 float GetBlue() const | |
86 { | |
87 return blue_; | |
88 } | |
89 | |
90 double GetX() const | |
91 { | |
92 return x_; | |
93 } | |
94 | |
95 double GetY() const | |
96 { | |
97 return y_; | |
98 } | |
99 | |
100 double GetBorder() const | |
101 { | |
102 return border_; | |
103 } | |
104 | |
105 unsigned int GetTextWidth() const | |
106 { | |
107 return textWidth_; | |
108 } | |
109 | |
110 unsigned int GetTextHeight() const | |
111 { | |
112 return textHeight_; | |
113 } | |
114 | |
115 BitmapAnchor GetAnchor() const | |
116 { | |
117 return anchor_; | |
118 } | |
119 }; | |
120 | |
121 private: | |
122 OpenGL::IOpenGLContext& context_; | |
123 std::auto_ptr<OpenGL::OpenGLProgram> program_; | |
124 GLint positionLocation_; | |
125 GLint textureLocation_; | |
126 | |
127 public: | |
128 OpenGLTextProgram(OpenGL::IOpenGLContext& context); | |
129 | |
130 void Apply(OpenGL::OpenGLTexture& fontTexture, | |
131 const Data& data, | |
132 const AffineTransform2D& transform); | |
133 }; | |
134 } | |
135 } |