rendered paste body SDL_SysWMinfo info;
SDL_VERSION(&info.version); // this is important!
if (SDL_GetWMInfo(&info))
{
// get the device context (DC)
_hdc = GetDC( info.window );
// set the pixel format for the DC
PIXELFORMATDESCRIPTOR pfd;
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
int format = ChoosePixelFormat( _hdc, &pfd );
SetPixelFormat( _hdc, format, &pfd );
// create the render context (RC)
_hglrc = wglCreateContext( _hdc );
wglMakeCurrent( _hdc, _hglrc );
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) wglGetProcAddress("wglCreateContextAttribsARB");
if ( wglCreateContextAttribsARB == NULL ) MessageBeep (0);
const int alist[] = {WGL_CONTEXT_DEBUG_BIT_ARB,NULL};
_hglrc2 = wglCreateContextAttribsARB (_hdc,0,alist);
// make it the current render context
wglMakeCurrent( _hdc, _hglrc2 );
wglDeleteContext(_hglrc);
}