haiku: Added support for some values set with SDL_GL_SetAttribute().
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h
index 2b15703..17fd253 100644
--- a/src/video/haiku/SDL_BWin.h
+++ b/src/video/haiku/SDL_BWin.h
@@ -72,6 +72,7 @@ class SDL_BWin:public BDirectWindow
#if SDL_VIDEO_OPENGL
_SDL_GLView = NULL;
+ _gl_type = 0;
#endif
_shown = false;
_inhibit_resize = false;
@@ -133,6 +134,7 @@ class SDL_BWin:public BDirectWindow
B_FOLLOW_ALL_SIDES,
(B_WILL_DRAW | B_FRAME_EVENTS),
gl_flags);
+ _gl_type = gl_flags;
}
AddChild(_SDL_GLView);
_SDL_GLView->EnableDirectMode(true);
@@ -443,6 +445,7 @@ class SDL_BWin:public BDirectWindow
BBitmap *GetBitmap() { return _bitmap; }
#if SDL_VIDEO_OPENGL
BGLView *GetGLView() { return _SDL_GLView; }
+ Uint32 GetGLType() { return _gl_type; }
#endif
/* Setter methods */
@@ -625,6 +628,7 @@ private:
/* Members */
#if SDL_VIDEO_OPENGL
BGLView * _SDL_GLView;
+ Uint32 _gl_type;
#endif
int32 _last_buttons;
diff --git a/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc
index 3a5cb91..b2a53fe 100644
--- a/src/video/haiku/SDL_bopengl.cc
+++ b/src/video/haiku/SDL_bopengl.cc
@@ -35,8 +35,6 @@ extern "C" {
#endif
-#define BGL_FLAGS BGL_RGB | BGL_DOUBLE
-
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata));
}
@@ -104,7 +102,28 @@ SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) {
/* FIXME: Not sure what flags should be included here; may want to have
most of them */
SDL_BWin *bwin = _ToBeWin(window);
- bwin->CreateGLView(BGL_FLAGS);
+ Uint32 gl_flags = BGL_RGB;
+ if (_this->gl_config.alpha_size) {
+ gl_flags |= BGL_ALPHA;
+ }
+ if (_this->gl_config.depth_size) {
+ gl_flags |= BGL_DEPTH;
+ }
+ if (_this->gl_config.stencil_size) {
+ gl_flags |= BGL_STENCIL;
+ }
+ if (_this->gl_config.double_buffer) {
+ gl_flags |= BGL_DOUBLE;
+ } else {
+ gl_flags |= BGL_SINGLE;
+ }
+ if (_this->gl_config.accum_red_size ||
+ _this->gl_config.accum_green_size ||
+ _this->gl_config.accum_blue_size ||
+ _this->gl_config.accum_alpha_size) {
+ gl_flags |= BGL_ACCUM;
+ }
+ bwin->CreateGLView(gl_flags);
return (SDL_GLContext)(bwin);
}
@@ -140,7 +159,7 @@ void BE_GL_RebootContexts(_THIS) {
if(bwin->GetGLView()) {
bwin->LockLooper();
bwin->RemoveGLView();
- bwin->CreateGLView(BGL_FLAGS);
+ bwin->CreateGLView(bwin->GetGLType());
bwin->UnlockLooper();
}
window = window->next;