/*! init the window: create the HDC and HGLRC
*/
void WIN32Window::init(GLInitFunctor oFunc)
{
    setHdc(GetDC(getHwnd()));

    if(getHglrc() == NULL)
    {
        setHglrc(wglCreateContext(getHdc()));
        
        if(getHglrc() == NULL)
        {
            std::cerr << "WIN32Window::init: failed: "
                      << GetLastError() 
                      << std::endl;        
        }
    }

    Inherited::init(oFunc);

    if(getHdc() != NULL) 
    {
        ReleaseDC(getHwnd(), getHdc());

        setHdc(NULL);
    }
}
void WIN32Window::terminate(void)
{
    Inherited::doTerminate();

     if(getHglrc() != NULL)
     {
         this->doDeactivate();

         wglDeleteContext(getHglrc());

         setHglrc(NULL);
     }
}
Пример #3
0
/*! init the window: create the HDC and HGLRC
*/
void WIN32Window::init( void )
{
    setHdc(GetDC(getHwnd()));

    if(getHglrc() == NULL )
    {
        setHglrc(wglCreateContext(getHdc()));

        if(getHglrc() == NULL)
        {
            SFATAL << "WIN32Window::init: failed: "
                   << GetLastError()
                   << endLog;
        }
    }

    ReleaseDC(getHwnd(),getHdc());
    activate();
    setupGL();
}