2015-06-12 03:57:41 +08:00
|
|
|
#include "context_gl_haiku.h"
|
|
|
|
|
|
|
|
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
|
|
|
|
2015-06-17 02:52:24 +08:00
|
|
|
ContextGL_Haiku::ContextGL_Haiku(HaikuDirectWindow* p_window) {
|
|
|
|
window = p_window;
|
2015-06-12 03:57:41 +08:00
|
|
|
|
2015-06-17 02:52:24 +08:00
|
|
|
uint32 type = BGL_RGB | BGL_DOUBLE | BGL_DEPTH;
|
2015-06-12 03:57:41 +08: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-17 02:52:24 +08:00
|
|
|
view->UnlockGL();
|
2015-06-12 03:57:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ContextGL_Haiku::make_current() {
|
2015-06-17 02:52:24 +08:00
|
|
|
view->LockGL();
|
2015-06-12 03:57:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ContextGL_Haiku::swap_buffers() {
|
|
|
|
view->SwapBuffers();
|
|
|
|
}
|
|
|
|
|
|
|
|
int ContextGL_Haiku::get_window_width() {
|
2015-06-17 02:52:24 +08:00
|
|
|
return window->Bounds().IntegerWidth();
|
2015-06-12 03:57:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int ContextGL_Haiku::get_window_height() {
|
2015-06-17 02:52:24 +08:00
|
|
|
return window->Bounds().IntegerHeight();
|
2016-03-09 07:00:52 +08:00
|
|
|
}
|
2015-06-12 03:57:41 +08:00
|
|
|
|
|
|
|
#endif
|