You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
711B

  1. #include <widget/OpenGlWidget.hpp>
  2. #include <app.hpp>
  3. namespace rack {
  4. namespace widget {
  5. void OpenGlWidget::step() {
  6. // Render every frame
  7. dirty = true;
  8. FramebufferWidget::step();
  9. }
  10. void OpenGlWidget::drawFramebuffer() {
  11. glViewport(0.0, 0.0, fbSize.x, fbSize.y);
  12. glClearColor(0.0, 0.0, 0.0, 1.0);
  13. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  14. glMatrixMode(GL_PROJECTION);
  15. glLoadIdentity();
  16. glOrtho(0.0, fbSize.x, 0.0, fbSize.y, -1.0, 1.0);
  17. glBegin(GL_TRIANGLES);
  18. glColor3f(1, 0, 0);
  19. glVertex3f(0, 0, 0);
  20. glColor3f(0, 1, 0);
  21. glVertex3f(fbSize.x, 0, 0);
  22. glColor3f(0, 0, 1);
  23. glVertex3f(0, fbSize.y, 0);
  24. glEnd();
  25. }
  26. } // namespace widget
  27. } // namespace rack