src/video/haiku/SDL_bopengl.cc
changeset 12082 09999a0e8f9a
parent 11811 5d94cb6b24d3
child 12503 806492103856
equal deleted inserted replaced
12081:277e57c09ff4 12082:09999a0e8f9a
    42 static SDL_INLINE SDL_BApp *_GetBeApp() {
    42 static SDL_INLINE SDL_BApp *_GetBeApp() {
    43     return ((SDL_BApp*)be_app);
    43     return ((SDL_BApp*)be_app);
    44 }
    44 }
    45 
    45 
    46 /* Passing a NULL path means load pointers from the application */
    46 /* Passing a NULL path means load pointers from the application */
    47 int BE_GL_LoadLibrary(_THIS, const char *path)
    47 int HAIKU_GL_LoadLibrary(_THIS, const char *path)
    48 {
    48 {
    49 /* FIXME: Is this working correctly? */
    49 /* FIXME: Is this working correctly? */
    50     image_info info;
    50     image_info info;
    51             int32 cookie = 0;
    51             int32 cookie = 0;
    52     while (get_next_image_info(0, &cookie, &info) == B_OK) {
    52     while (get_next_image_info(0, &cookie, &info) == B_OK) {
    61         }
    61         }
    62     }
    62     }
    63     return 0;
    63     return 0;
    64 }
    64 }
    65 
    65 
    66 void *BE_GL_GetProcAddress(_THIS, const char *proc)
    66 void *HAIKU_GL_GetProcAddress(_THIS, const char *proc)
    67 {
    67 {
    68     if (_this->gl_config.dll_handle != NULL) {
    68     if (_this->gl_config.dll_handle != NULL) {
    69         void *location = NULL;
    69         void *location = NULL;
    70         status_t err;
    70         status_t err;
    71         if ((err =
    71         if ((err =
    84 }
    84 }
    85 
    85 
    86 
    86 
    87 
    87 
    88 
    88 
    89 int BE_GL_SwapWindow(_THIS, SDL_Window * window) {
    89 int HAIKU_GL_SwapWindow(_THIS, SDL_Window * window) {
    90     _ToBeWin(window)->SwapBuffers();
    90     _ToBeWin(window)->SwapBuffers();
    91     return 0;
    91     return 0;
    92 }
    92 }
    93 
    93 
    94 int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
    94 int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
    95     SDL_BWin* win = (SDL_BWin*)context;
    95     SDL_BWin* win = (SDL_BWin*)context;
    96     _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL);
    96     _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL);
    97     return 0;
    97     return 0;
    98 }
    98 }
    99 
    99 
   100 
   100 
   101 SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) {
   101 SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) {
   102     /* FIXME: Not sure what flags should be included here; may want to have
   102     /* FIXME: Not sure what flags should be included here; may want to have
   103        most of them */
   103        most of them */
   104     SDL_BWin *bwin = _ToBeWin(window);
   104     SDL_BWin *bwin = _ToBeWin(window);
   105     Uint32 gl_flags = BGL_RGB;
   105     Uint32 gl_flags = BGL_RGB;
   106     if (_this->gl_config.alpha_size) {
   106     if (_this->gl_config.alpha_size) {
   125     }
   125     }
   126     bwin->CreateGLView(gl_flags);
   126     bwin->CreateGLView(gl_flags);
   127     return (SDL_GLContext)(bwin);
   127     return (SDL_GLContext)(bwin);
   128 }
   128 }
   129 
   129 
   130 void BE_GL_DeleteContext(_THIS, SDL_GLContext context) {
   130 void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) {
   131     /* Currently, automatically unlocks the view */
   131     /* Currently, automatically unlocks the view */
   132     ((SDL_BWin*)context)->RemoveGLView();
   132     ((SDL_BWin*)context)->RemoveGLView();
   133 }
   133 }
   134 
   134 
   135 
   135 
   136 int BE_GL_SetSwapInterval(_THIS, int interval) {
   136 int HAIKU_GL_SetSwapInterval(_THIS, int interval) {
   137     /* TODO: Implement this, if necessary? */
   137     /* TODO: Implement this, if necessary? */
   138     return SDL_Unsupported();
   138     return SDL_Unsupported();
   139 }
   139 }
   140 
   140 
   141 int BE_GL_GetSwapInterval(_THIS) {
   141 int HAIKU_GL_GetSwapInterval(_THIS) {
   142     /* TODO: Implement this, if necessary? */
   142     /* TODO: Implement this, if necessary? */
   143     return 0;
   143     return 0;
   144 }
   144 }
   145 
   145 
   146 
   146 
   147 void BE_GL_UnloadLibrary(_THIS) {
   147 void HAIKU_GL_UnloadLibrary(_THIS) {
   148     /* TODO: Implement this, if necessary? */
   148     /* TODO: Implement this, if necessary? */
   149 }
   149 }
   150 
   150 
   151 
   151 
   152 /* FIXME: This function is meant to clear the OpenGL context when the video
   152 /* FIXME: This function is meant to clear the OpenGL context when the video
   153    mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not
   153    mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not
   154    currently in use. */
   154    currently in use. */
   155 void BE_GL_RebootContexts(_THIS) {
   155 void HAIKU_GL_RebootContexts(_THIS) {
   156     SDL_Window *window = _this->windows;
   156     SDL_Window *window = _this->windows;
   157     while(window) {
   157     while(window) {
   158         SDL_BWin *bwin = _ToBeWin(window);
   158         SDL_BWin *bwin = _ToBeWin(window);
   159         if(bwin->GetGLView()) {
   159         if(bwin->GetGLView()) {
   160             bwin->LockLooper();
   160             bwin->LockLooper();