| 145 | } |
| 146 | |
| 147 | void SimulationView::draw() |
| 148 | { |
| 149 | if (_renderSimulation) { |
| 150 | updateImageFromSimulation(); |
| 151 | |
| 152 | _shader->use(); |
| 153 | |
| 154 | GLint currentFbo; |
| 155 | glGetIntegerv(GL_FRAMEBUFFER_BINDING, ¤tFbo); |
| 156 | |
| 157 | glBindFramebuffer(GL_FRAMEBUFFER, _fbo1); |
| 158 | _shader->setInt("phase", 0); |
| 159 | glBindVertexArray(_vao); |
| 160 | glActiveTexture(GL_TEXTURE0); |
| 161 | glBindTexture(GL_TEXTURE_2D, _textureSimulationId); |
| 162 | glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); |
| 163 | |
| 164 | glBindFramebuffer(GL_FRAMEBUFFER, _fbo2); |
| 165 | _shader->setInt("phase", 1); |
| 166 | glActiveTexture(GL_TEXTURE0); |
| 167 | glBindTexture(GL_TEXTURE_2D, _textureSimulationId); |
| 168 | glActiveTexture(GL_TEXTURE1); |
| 169 | glBindTexture(GL_TEXTURE_2D, _textureFramebufferId1); |
| 170 | glActiveTexture(GL_TEXTURE2); |
| 171 | glBindTexture(GL_TEXTURE_2D, _textureFramebufferId2); |
| 172 | glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); |
| 173 | |
| 174 | glBindFramebuffer(GL_FRAMEBUFFER, currentFbo); |
| 175 | _shader->setInt("phase", 2); |
| 176 | glActiveTexture(GL_TEXTURE0); |
| 177 | glBindTexture(GL_TEXTURE_2D, _textureFramebufferId2); |
| 178 | glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); |
| 179 | |
| 180 | if (_simulationFacade->getSimulationParameters().markReferenceDomain) { |
| 181 | markReferenceDomain(); |
| 182 | } |
| 183 | |
| 184 | } else { |
| 185 | glClearColor(0, 0, 0.0f, 1.0f); |
| 186 | glClear(GL_COLOR_BUFFER_BIT); |
| 187 | |
| 188 | auto textWidth = scale(300.0f); |
| 189 | auto textHeight = scale(80.0f); |
| 190 | ImDrawList* drawList = ImGui::GetBackgroundDrawList(); |
| 191 | auto& styleRep = StyleRepository::get(); |
| 192 | auto right = ImGui::GetMainViewport()->Pos.x + ImGui::GetMainViewport()->Size.x; |
| 193 | auto bottom = ImGui::GetMainViewport()->Pos.y + ImGui::GetMainViewport()->Size.y; |
| 194 | auto maxLength = std::max(right, bottom); |
| 195 | |
| 196 | AlienImGui::RotateStart(drawList); |
| 197 | auto font = styleRep.getReefLargeFont(); |
| 198 | auto text = "Rendering disabled"; |
| 199 | ImVec4 clipRect(-100000.0f, -100000.0f, 100000.0f, 100000.0f); |
| 200 | for (int i = 0; toFloat(i) * textWidth < maxLength * 2; ++i) { |
| 201 | for (int j = 0; toFloat(j) * textHeight < maxLength * 2; ++j) { |
| 202 | font->RenderText( |
| 203 | drawList, |
| 204 | scale(34.0f), |
no test coverage detected