comparison Framework/Scene2D/OpenGLCompositor.cpp @ 892:50cd372e2460

fix OpenGL context for fonts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jul 2019 09:18:55 +0200
parents 0aff28f15ea2
children 9c2f6d6b9f4a
comparison
equal deleted inserted replaced
891:0aff28f15ea2 892:50cd372e2460
147 } 147 }
148 148
149 149
150 void OpenGLCompositor::Refresh() 150 void OpenGLCompositor::Refresh()
151 { 151 {
152 context_.MakeCurrent();
153
152 canvasWidth_ = context_.GetCanvasWidth(); 154 canvasWidth_ = context_.GetCanvasWidth();
153 canvasHeight_ = context_.GetCanvasHeight(); 155 canvasHeight_ = context_.GetCanvasHeight();
154
155 context_.MakeCurrent();
156 156
157 glViewport(0, 0, canvasWidth_, canvasHeight_); 157 glViewport(0, 0, canvasWidth_, canvasHeight_);
158 glClearColor(0, 0, 0, 1); 158 glClearColor(0, 0, 0, 1);
159 glClear(GL_COLOR_BUFFER_BIT); 159 glClear(GL_COLOR_BUFFER_BIT);
160 160
165 165
166 166
167 void OpenGLCompositor::SetFont(size_t index, 167 void OpenGLCompositor::SetFont(size_t index,
168 const GlyphBitmapAlphabet& dict) 168 const GlyphBitmapAlphabet& dict)
169 { 169 {
170 context_.MakeCurrent();
171
170 std::auto_ptr<Font> font(new Font(dict)); 172 std::auto_ptr<Font> font(new Font(dict));
171 173
172 Fonts::iterator found = fonts_.find(index); 174 Fonts::iterator found = fonts_.find(index);
173 175
174 if (found == fonts_.end()) 176 if (found == fonts_.end())