Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/OpenGLCompositor.cpp @ 897:9c2f6d6b9f4a am-dev
Merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Tue, 16 Jul 2019 12:37:29 +0200 |
parents | 80829436ce0c 50cd372e2460 |
children | 685c9a2d115f |
comparison
equal
deleted
inserted
replaced
896:875bd6aca5e6 | 897:9c2f6d6b9f4a |
---|---|
132 linesProgram_(context), | 132 linesProgram_(context), |
133 textProgram_(context), | 133 textProgram_(context), |
134 canvasWidth_(0), | 134 canvasWidth_(0), |
135 canvasHeight_(0) | 135 canvasHeight_(0) |
136 { | 136 { |
137 UpdateSize(); | |
138 } | 137 } |
139 | 138 |
140 | 139 |
141 OpenGLCompositor::~OpenGLCompositor() | 140 OpenGLCompositor::~OpenGLCompositor() |
142 { | 141 { |
146 delete it->second; | 145 delete it->second; |
147 } | 146 } |
148 } | 147 } |
149 | 148 |
150 | 149 |
151 void OpenGLCompositor::UpdateSize() | 150 void OpenGLCompositor::Refresh() |
152 { | 151 { |
152 context_.MakeCurrent(); | |
153 | |
153 canvasWidth_ = context_.GetCanvasWidth(); | 154 canvasWidth_ = context_.GetCanvasWidth(); |
154 canvasHeight_ = context_.GetCanvasHeight(); | 155 canvasHeight_ = context_.GetCanvasHeight(); |
155 | 156 |
156 context_.MakeCurrent(); | |
157 glViewport(0, 0, canvasWidth_, canvasHeight_); | 157 glViewport(0, 0, canvasWidth_, canvasHeight_); |
158 } | |
159 | |
160 | |
161 void OpenGLCompositor::Refresh() | |
162 { | |
163 context_.MakeCurrent(); | |
164 | |
165 glClearColor(0, 0, 0, 1); | 158 glClearColor(0, 0, 0, 1); |
166 glClear(GL_COLOR_BUFFER_BIT); | 159 glClear(GL_COLOR_BUFFER_BIT); |
167 | 160 |
168 helper_.Refresh(canvasWidth_, canvasHeight_); | 161 helper_.Refresh(canvasWidth_, canvasHeight_); |
169 | 162 |
172 | 165 |
173 | 166 |
174 void OpenGLCompositor::SetFont(size_t index, | 167 void OpenGLCompositor::SetFont(size_t index, |
175 const GlyphBitmapAlphabet& dict) | 168 const GlyphBitmapAlphabet& dict) |
176 { | 169 { |
170 context_.MakeCurrent(); | |
171 | |
177 std::auto_ptr<Font> font(new Font(dict)); | 172 std::auto_ptr<Font> font(new Font(dict)); |
178 | 173 |
179 Fonts::iterator found = fonts_.find(index); | 174 Fonts::iterator found = fonts_.find(index); |
180 | 175 |
181 if (found == fonts_.end()) | 176 if (found == fonts_.end()) |