Hi,

I found the problem.

> hmm interesting it's stuck while logging. But nothing really indicates
> why, it does not look like a loop, more like a lock or barrier. And it
> is outside any OpenSG loop and also does not seem to hit OpenSG the
> lock inside Log. Hmm, I'll have to think about it a little.

This was because wglMakeCurrent failed in WIN32Window::doActivate and
therefore glGetError always returns an error in Window::doFrameExit -
calling glGetError without a valid context is illegal. Therefore it never
left the while loop in OSGWindow.cpp line 1527.

So now to why a call to wglMakeCurrent could possibly fail: My window class
did not have the CS_OWNDC flag set, so every call to GetDC() might return a
different, new handle. The handle that I set using WIN32Window::setHdc was
correct, however OpenSG does overwrite it in WIN32Window::init
(OSGWIN32Window.cpp line 116) which is obviously not the way to do it
(otherwise the setHdc method is useless).

I would prefer init() something like:

{
        bool we_used_getdc = false;
        if (getHdc() == NULL) {
                setHdc(GetDC(getHwnd()));
                we_used_getdc = true;
        }

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

        if (we_used_getdc)
                ReleaseDC(getHwnd(), getHdc());

    this->doActivate();

    Inherited::init(oFunc);

    this->doDeactivate();
}

At least my application starts now and crashes later ...

Aloha, Andi


------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to