Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/OpenGLCompositor.cpp @ 1211:d10d2acb8a02 broker
compositors do not keep a reference to the scene anymore
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 04 Dec 2019 16:47:21 +0100 |
parents | 32eaf4929b08 |
children | 3fe803f65c47 |
comparison
equal
deleted
inserted
replaced
1210:644baa70373d | 1211:d10d2acb8a02 |
---|---|
126 // context is lost. returning null. | 126 // context is lost. returning null. |
127 return NULL; | 127 return NULL; |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 OpenGLCompositor::OpenGLCompositor(OpenGL::IOpenGLContext& context, | 131 OpenGLCompositor::OpenGLCompositor(OpenGL::IOpenGLContext& context) : |
132 const Scene2D& scene) : | |
133 context_(context), | 132 context_(context), |
134 helper_(scene, *this), | |
135 colorTextureProgram_(context), | 133 colorTextureProgram_(context), |
136 floatTextureProgram_(context), | 134 floatTextureProgram_(context), |
137 linesProgram_(context), | 135 linesProgram_(context), |
138 textProgram_(context), | 136 textProgram_(context), |
139 canvasWidth_(0), | 137 canvasWidth_(0), |
140 canvasHeight_(0) | 138 canvasHeight_(0) |
141 { | 139 { |
140 ResetScene(); | |
142 } | 141 } |
143 | 142 |
144 OpenGLCompositor::~OpenGLCompositor() | 143 OpenGLCompositor::~OpenGLCompositor() |
145 { | 144 { |
146 if (!context_.IsContextLost()) | 145 if (!context_.IsContextLost()) |
152 delete it->second; | 151 delete it->second; |
153 } | 152 } |
154 } | 153 } |
155 } | 154 } |
156 | 155 |
157 void OpenGLCompositor::Refresh() | 156 void OpenGLCompositor::Refresh(const Scene2D& scene) |
158 { | 157 { |
159 if (!context_.IsContextLost()) | 158 if (!context_.IsContextLost()) |
160 { | 159 { |
161 context_.MakeCurrent(); // this can throw if context lost! | 160 context_.MakeCurrent(); // this can throw if context lost! |
162 | 161 |
165 | 164 |
166 glViewport(0, 0, canvasWidth_, canvasHeight_); | 165 glViewport(0, 0, canvasWidth_, canvasHeight_); |
167 glClearColor(0, 0, 0, 1); | 166 glClearColor(0, 0, 0, 1); |
168 glClear(GL_COLOR_BUFFER_BIT); | 167 glClear(GL_COLOR_BUFFER_BIT); |
169 | 168 |
170 helper_.Refresh(canvasWidth_, canvasHeight_); | 169 helper_->Refresh(scene, canvasWidth_, canvasHeight_); |
171 | 170 |
172 context_.SwapBuffer(); | 171 context_.SwapBuffer(); |
173 } | 172 } |
174 | |
175 } | 173 } |
176 | 174 |
177 void OpenGLCompositor::SetFont(size_t index, | 175 void OpenGLCompositor::SetFont(size_t index, |
178 const GlyphBitmapAlphabet& dict) | 176 const GlyphBitmapAlphabet& dict) |
179 { | 177 { |