| 99 | } |
| 100 | |
| 101 | GLuint StageView::render(Stage& stage) const { |
| 102 | if (fbo_ == 0) { |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | canvas_.glBindFramebuffer(GL_FRAMEBUFFER, fbo_); |
| 107 | canvas_.glViewport(0, 0, width_, height_); |
| 108 | canvas_.glClearColor(0.1f, 0.1f, 0.1f, 1.0f); |
| 109 | canvas_.glClear(GL_COLOR_BUFFER_BIT); |
| 110 | |
| 111 | // A VAO must be bound for the viz layer's glDrawArrays calls to produce |
| 112 | // output in a core-profile context; bind ours each frame since ImGui's |
| 113 | // backend rebinds/clears the VAO binding when it renders. |
| 114 | // Enable alpha blending for this pass so the pixel-value text overlay |
| 115 | // (glyph coverage lives in the fragment alpha) composites over the buffer |
| 116 | // instead of painting opaque glyph-quad boxes. Set every frame: ImGui's GL |
| 117 | // backend saves/restores blend state around its own render and leaves it |
| 118 | // disabled between our passes (same reason the VAO is rebound above). |
| 119 | canvas_.glEnable(GL_BLEND); |
| 120 | canvas_.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 121 | |
| 122 | canvas_.glBindVertexArray(vao_); |
| 123 | stage.update(); |
| 124 | stage.draw(); |
| 125 | canvas_.glBindVertexArray(0); |
| 126 | |
| 127 | canvas_.glBindFramebuffer(GL_FRAMEBUFFER, 0); |
| 128 | return texture_; |
| 129 | } |
| 130 | |
| 131 | } // namespace oid::host |
no test coverage detected