context_gl_haiku.cpp 809 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "context_gl_haiku.h"
  2. #if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
  3. ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow* p_window) {
  4. window = p_window;
  5. uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH;
  6. view = new HaikuGLView(window->Bounds(), type);
  7. }
  8. ContextGL_Haiku::~ContextGL_Haiku() {
  9. delete view;
  10. }
  11. Error ContextGL_Haiku::initialize() {
  12. window->AddChild(view);
  13. window->SetHaikuGLView(view);
  14. return OK;
  15. }
  16. void ContextGL_Haiku::release_current() {
  17. view->UnlockGL();
  18. }
  19. void ContextGL_Haiku::make_current() {
  20. view->LockGL();
  21. }
  22. void ContextGL_Haiku::swap_buffers() {
  23. view->SwapBuffers();
  24. }
  25. int ContextGL_Haiku::get_window_width() {
  26. return window->Bounds().IntegerWidth();
  27. }
  28. int ContextGL_Haiku::get_window_height() {
  29. return window->Bounds().IntegerHeight();
  30. }
  31. #endif