Skip to content

Commit

Permalink
Added a way to get the Windows OpenGL context in SDL_syswm.h
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 17, 2002
1 parent 200b10e commit 4459a61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/SDL_syswm.h
Expand Up @@ -111,6 +111,7 @@ typedef struct {
} SDL_SysWMinfo;

#elif defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

/* The windows custom event structure */
Expand All @@ -126,6 +127,7 @@ struct SDL_SysWMmsg {
typedef struct {
SDL_version version;
HWND window; /* The Win32 display window */
HGLRC hglrc; /* The OpenGL context, if any */
} SDL_SysWMinfo;

#else
Expand Down
10 changes: 10 additions & 0 deletions src/video/wincommon/SDL_syswm.c
Expand Up @@ -267,6 +267,16 @@ int WIN_GetWMInfo(_THIS, SDL_SysWMinfo *info)
{
if ( info->version.major <= SDL_MAJOR_VERSION ) {
info->window = SDL_Window;
if ( SDL_VERSIONNUM(info->version.major,
info->version.minor,
info->version.patch) >=
SDL_VERSION(1, 2, 5) ) {
#ifdef HAVE_OPENGL
info->hglrc = GL_hrc;
#else
info->hglrc = NULL;
#endif
}
return(1);
} else {
SDL_SetError("Application not compiled with SDL %d.%d\n",
Expand Down

0 comments on commit 4459a61

Please sign in to comment.