Commit e8d4a664 authored by Sam Lantinga's avatar Sam Lantinga

Added a way to get the Windows OpenGL context in SDL_syswm.h

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40439
parent 44bb9d26
...@@ -111,6 +111,7 @@ typedef struct { ...@@ -111,6 +111,7 @@ typedef struct {
} SDL_SysWMinfo; } SDL_SysWMinfo;
#elif defined(WIN32) #elif defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
/* The windows custom event structure */ /* The windows custom event structure */
...@@ -126,6 +127,7 @@ struct SDL_SysWMmsg { ...@@ -126,6 +127,7 @@ struct SDL_SysWMmsg {
typedef struct { typedef struct {
SDL_version version; SDL_version version;
HWND window; /* The Win32 display window */ HWND window; /* The Win32 display window */
HGLRC hglrc; /* The OpenGL context, if any */
} SDL_SysWMinfo; } SDL_SysWMinfo;
#else #else
......
...@@ -267,6 +267,16 @@ int WIN_GetWMInfo(_THIS, SDL_SysWMinfo *info) ...@@ -267,6 +267,16 @@ int WIN_GetWMInfo(_THIS, SDL_SysWMinfo *info)
{ {
if ( info->version.major <= SDL_MAJOR_VERSION ) { if ( info->version.major <= SDL_MAJOR_VERSION ) {
info->window = SDL_Window; 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); return(1);
} else { } else {
SDL_SetError("Application not compiled with SDL %d.%d\n", SDL_SetError("Application not compiled with SDL %d.%d\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment