Hello Johannes,

Johannes Brunen wrote:
[SNIP]
> However, I'm facing a situation that when I have more then two windows
> the rendering of one
> window stalls for some time and eventually all windows get frozen. 
> With only one or two windows all is working perfektly fine.
> 
> What is happening when one window stalls for some time I don't know.
> But, when all windows
> eventually freeze I could see that the the program endlessly runs into
> the glErr macro in the 
> function RenderAction::start().
> 
> With the help of the gliIntercept tool I could see that the last call
> before the error
> GL_INVALID_OPERATION (0x502) was a call to glDisable(GL_SCISSOR_TEST).
> 
> Extract from the log:
> 
> glGetError()=GL_NO_ERROR 
> glLoadMatrixf([-0.766076,0.445564,-0.463248,0.000000,-0.393384,0.244951,
> 0.886141,0.000000,0.508305,0.861088,-0.012371,0.000000,49.977875,41.0812
> 68,-234.204254,1.000000])
> glCallList(3)
> glDisable(GL_LIGHTING)
> glDisable(GL_COLOR_MATERIAL)
> glDisable(GL_LIGHT0)
> glDepthMask(true)
> glFinish()
> wglSwapBuffers(0x0000)=false 
> glGetError()=GL_NO_ERROR 
> wglMakeCurrent(0x0000,0x0000)=true 
                 ^^^^^^^^^^^^^
this looks like a successful WIN32Window::deactivate

> wglMakeCurrent(0x0000,0x10001)=false 
> wglMakeCurrent(0x0000,0x10001)=false 
                                 ^^^^^^
however this does not look good, wglMakeCurrent fails

> glViewport(0,0,600,227)
> glDisable(GL_SCISSOR_TEST)
> glGetError()=GL_INVALID_OPERATION

the OpenGL functions fail, because (apparently) there is no active context.

[SNIP]

> void CompositeViewer::Render()
> {
>     if (!_win) return;
> 
>     if (!_iDynamicCnt) {
>         redraw();                             // This is the branch
> which is used in the problem scenario. The other is not called at all.
>         _win->deactivate();
                ^^^^^^^^^^^^

is there a corresponding _win->activate() call in code you did not show 
here ?

>     } else {
>         DoRenderStatic();
>     }
> }

[SNIP]

> Gc3SystemData::Gc3SystemData(HWND hWnd)
> : _hWnd(hWnd)
> , _viewer(graphic::CompositeViewer::create())
> , _bIsInitialized(false)
> , _vecVisualizer()
> , _stackVisualizer()
> {
>     DWORD dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
> PFD_DOUBLEBUFFER;
>     PIXELFORMATDESCRIPTOR pixelFormat = {
>         sizeof(PIXELFORMATDESCRIPTOR),
>         1,
>         dwFlags,
>         PFD_TYPE_RGBA,
>         24,
>         0, 0, 0, 0, 0, 0,
>         0, 0,
>         0, 0, 0, 0, 0,
>         32,
>         0,
>         0,
>         PFD_MAIN_PLANE,
>         0,
>         0, 0, 0
>     };
> 
>     HDC hdc = ::GetDC(_hWnd);

this might clash with WIN32Window::init as it also calls GetDC and the 
MS docs say this:

<quote>
Note that the handle to the DC can only be used by a single thread at 
any one time.

After painting with a common DC, the ReleaseDC function must be called 
to release the DC. Class and private DCs do not have to be released. 
ReleaseDC must be called from the same thread that called GetDC. The 
number of DCs is limited only by available memory.
</quote>

I'm not sure what that means for calling GetDC multiple times from the 
same thread though...

>     if (!hdc) {
>         ::DestroyWindow(_hWnd);
>         return;
>     }
> 
>     int pixelFormatIndex = ::ChoosePixelFormat(hdc, &pixelFormat);
>     if (!pixelFormatIndex) {
>         ::ReleaseDC(_hWnd, hdc);
>         ::DestroyWindow(_hWnd);
>         return;
>     }
> 
>     if (!::SetPixelFormat(hdc, pixelFormatIndex, &pixelFormat)) {
>         ::ReleaseDC(_hWnd, hdc);
>         ::DestroyWindow(_hWnd);
>         return;
>     }
> 
>     Initialize();
> }
[SNIP]

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to