comparison Framework/Scene2D/OpenGLCompositor.cpp @ 1482:5c96bf3f1d32

IOpenGL::RefreshCanvasSize()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 20 Jun 2020 11:08:28 +0200
parents 28c64c246312
children
comparison
equal deleted inserted replaced
1481:970ee51fe01f 1482:5c96bf3f1d32
185 void OpenGLCompositor::Refresh(const Scene2D& scene) 185 void OpenGLCompositor::Refresh(const Scene2D& scene)
186 { 186 {
187 if (!context_.IsContextLost()) 187 if (!context_.IsContextLost())
188 { 188 {
189 context_.MakeCurrent(); // this can throw if context lost! 189 context_.MakeCurrent(); // this can throw if context lost!
190
191 canvasWidth_ = context_.GetCanvasWidth(); 190 canvasWidth_ = context_.GetCanvasWidth();
192 canvasHeight_ = context_.GetCanvasHeight(); 191 canvasHeight_ = context_.GetCanvasHeight();
193 192
194 glViewport(0, 0, canvasWidth_, canvasHeight_); 193 glViewport(0, 0, canvasWidth_, canvasHeight_);
195 glClearColor(0, 0, 0, 1); 194 glClearColor(0, 0, 0, 1);
242 241
243 SetFont(index, dict); 242 SetFont(index, dict);
244 } 243 }
245 } 244 }
246 #endif 245 #endif
246
247
248 void OpenGLCompositor::RefreshCanvasSize()
249 {
250 if (!context_.IsContextLost())
251 {
252 context_.MakeCurrent(); // this can throw if context lost!
253 context_.RefreshCanvasSize(); // Difference with Refresh(scene)
254 canvasWidth_ = context_.GetCanvasWidth();
255 canvasHeight_ = context_.GetCanvasHeight();
256 }
257 }
247 } 258 }