Skip to content

Commit

Permalink
haiku: Added support for some values set with SDL_GL_SetAttribute().
Browse files Browse the repository at this point in the history
  • Loading branch information
philippwiesemann committed Jun 17, 2017
1 parent 6086e8d commit 90488d6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/video/haiku/SDL_BWin.h
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -625,6 +628,7 @@ class SDL_BWin:public BDirectWindow
/* Members */
#if SDL_VIDEO_OPENGL
BGLView * _SDL_GLView;
Uint32 _gl_type;
#endif

int32 _last_buttons;
Expand Down
27 changes: 23 additions & 4 deletions src/video/haiku/SDL_bopengl.cc
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 90488d6

Please sign in to comment.