2015-06-11 21:57:41 +02:00
|
|
|
#include "context_gl_haiku.h"
|
|
|
|
|
|
|
|
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
|
|
|
|
2015-06-16 20:52:24 +02:00
|
|
|
ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow* p_window) {
|
|
|
|
window = p_window;
|
2015-06-11 21:57:41 +02:00
|
|
|
|
2015-06-16 20:52:24 +02:00
|
|
|
uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH;
|
2015-06-11 21:57:41 +02:00
|
|
|
view = new HaikuGLView(window->Bounds(), type);
|
|
|
|
}
|
|
|
|
|
|
|
|
ContextGL_Haiku::~ContextGL_Haiku() {
|
|
|
|
delete view;
|
|
|
|
}
|
|
|
|
|
|
|
|
Error ContextGL_Haiku::initialize() {
|
|
|
|
window->AddChild(view);
|
|
|
|
window->SetHaikuGLView(view);
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ContextGL_Haiku::release_current() {
|
2015-06-16 20:52:24 +02:00
|
|
|
view->UnlockGL();
|
2015-06-11 21:57:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ContextGL_Haiku::make_current() {
|
2015-06-16 20:52:24 +02:00
|
|
|
view->LockGL();
|
2015-06-11 21:57:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ContextGL_Haiku::swap_buffers() {
|
|
|
|
view->SwapBuffers();
|
|
|
|
}
|
|
|
|
|
|
|
|
int ContextGL_Haiku::get_window_width() {
|
2015-06-16 20:52:24 +02:00
|
|
|
return window->Bounds().IntegerWidth();
|
2015-06-11 21:57:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int ContextGL_Haiku::get_window_height() {
|
2015-06-16 20:52:24 +02:00
|
|
|
return window->Bounds().IntegerHeight();
|
2015-06-11 21:57:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|