haiku: Added support for some values set with SDL_GL_SetAttribute().
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 17 Jun 2017 22:30:28 +0200
changeset 11107a5fe51ef0877
parent 11106 3aadcf084374
child 11108 9c7a4a9b79d7
haiku: Added support for some values set with SDL_GL_SetAttribute().
src/video/haiku/SDL_BWin.h
src/video/haiku/SDL_bopengl.cc
     1.1 --- a/src/video/haiku/SDL_BWin.h	Sat Jun 17 22:30:09 2017 +0200
     1.2 +++ b/src/video/haiku/SDL_BWin.h	Sat Jun 17 22:30:28 2017 +0200
     1.3 @@ -72,6 +72,7 @@
     1.4  
     1.5  #if SDL_VIDEO_OPENGL
     1.6          _SDL_GLView = NULL;
     1.7 +        _gl_type = 0;
     1.8  #endif
     1.9          _shown = false;
    1.10          _inhibit_resize = false;
    1.11 @@ -133,6 +134,7 @@
    1.12                                       B_FOLLOW_ALL_SIDES,
    1.13                                       (B_WILL_DRAW | B_FRAME_EVENTS),
    1.14                                       gl_flags);
    1.15 +            _gl_type = gl_flags;
    1.16          }
    1.17          AddChild(_SDL_GLView);
    1.18          _SDL_GLView->EnableDirectMode(true);
    1.19 @@ -443,6 +445,7 @@
    1.20      BBitmap *GetBitmap() { return _bitmap; }
    1.21  #if SDL_VIDEO_OPENGL
    1.22      BGLView *GetGLView() { return _SDL_GLView; }
    1.23 +    Uint32 GetGLType() { return _gl_type; }
    1.24  #endif
    1.25  
    1.26      /* Setter methods */
    1.27 @@ -625,6 +628,7 @@
    1.28      /* Members */
    1.29  #if SDL_VIDEO_OPENGL
    1.30      BGLView * _SDL_GLView;
    1.31 +    Uint32 _gl_type;
    1.32  #endif
    1.33  
    1.34      int32 _last_buttons;
     2.1 --- a/src/video/haiku/SDL_bopengl.cc	Sat Jun 17 22:30:09 2017 +0200
     2.2 +++ b/src/video/haiku/SDL_bopengl.cc	Sat Jun 17 22:30:28 2017 +0200
     2.3 @@ -35,8 +35,6 @@
     2.4  #endif
     2.5  
     2.6  
     2.7 -#define BGL_FLAGS BGL_RGB | BGL_DOUBLE
     2.8 -
     2.9  static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
    2.10      return ((SDL_BWin*)(window->driverdata));
    2.11  }
    2.12 @@ -104,7 +102,28 @@
    2.13      /* FIXME: Not sure what flags should be included here; may want to have
    2.14         most of them */
    2.15      SDL_BWin *bwin = _ToBeWin(window);
    2.16 -    bwin->CreateGLView(BGL_FLAGS);
    2.17 +    Uint32 gl_flags = BGL_RGB;
    2.18 +    if (_this->gl_config.alpha_size) {
    2.19 +        gl_flags |= BGL_ALPHA;
    2.20 +    }
    2.21 +    if (_this->gl_config.depth_size) {
    2.22 +        gl_flags |= BGL_DEPTH;
    2.23 +    }
    2.24 +    if (_this->gl_config.stencil_size) {
    2.25 +        gl_flags |= BGL_STENCIL;
    2.26 +    }
    2.27 +    if (_this->gl_config.double_buffer) {
    2.28 +        gl_flags |= BGL_DOUBLE;
    2.29 +    } else {
    2.30 +        gl_flags |= BGL_SINGLE;
    2.31 +    }
    2.32 +    if (_this->gl_config.accum_red_size ||
    2.33 +            _this->gl_config.accum_green_size ||
    2.34 +            _this->gl_config.accum_blue_size ||
    2.35 +            _this->gl_config.accum_alpha_size) {
    2.36 +        gl_flags |= BGL_ACCUM;
    2.37 +    }
    2.38 +    bwin->CreateGLView(gl_flags);
    2.39      return (SDL_GLContext)(bwin);
    2.40  }
    2.41  
    2.42 @@ -140,7 +159,7 @@
    2.43          if(bwin->GetGLView()) {
    2.44              bwin->LockLooper();
    2.45              bwin->RemoveGLView();
    2.46 -            bwin->CreateGLView(BGL_FLAGS);
    2.47 +            bwin->CreateGLView(bwin->GetGLType());
    2.48              bwin->UnlockLooper();
    2.49          }
    2.50          window = window->next;