Multiple Windows/Adapters: wglMakeCurrent fails


i’m currently working for a client to get a multi-monitor application up and running on a system with 2 ATI FirePro V8800 cards. To each card four monitors are connected. The layout of the monitors is two rows, with 4 monitors each, the bottom row being connected to the primary display adapter.

The application does the following in terms of wgl and ogl:

  • create a rendering context on application start up. this rendering context is used for all rendering throughout the application.
  • the application allows the user to create new windows displaying specific information. Each active window is added to a list of targets to be rendered to. The pixel format of the client area control OpenGL should render to is set to support HW-accelerated OpenGL rendering.
  • in the rendering thread (which is actually the UI message dispatch thread, where we listen for idle events) the renderer runs through the list of target windows.
  • for each window its device context (or rather the DC of a control contained in the window) is fetched (GetDC), the rendering context is made current with this device context, the scene for that window is rendered, wglSwapBuffers is invoked followed by a call to wglMakeCurrent(null, null) and (ReleaseDC).

This works perfectly fine as long as windows are only created on monitors of the primary display adapter (bottom row in the setup described above). As soon as windows are created on a display of the secondary adapter wglMakeCurrent fails, with GetLastError returning zero.

The code is written in C#, using the Tao Framework, the device context setup is done via the standard GDI ChoosePixelFormat and SetPixelFormat functions. The pixel formats for all the windows are the same, so i can rule out that this is the issue (i double check the return value of ChoosePixelFormat for all subsequent windows after creating the first window and settings its pixel format).

The behaviour is not reproduceable on NVIDIA cards, which leads me to the believe that this might be a driver issue. However, i wanted to pass this way of rendering by this forum first before i draw any conclusions. Do you see any glaring errors in the above description?

Indeed this can depend on the driver implementation.
Did you try creating a second RC, on the secondary display adapter ?

No, for various reasons that are out of my control (software architecture of the client’s application) we have to work with a single rendering context.

The problem is indeed related to displaying windows on a display of the second adapter. I threw together a demo application that will spawn a window on the primary adapter and then let me createa a new window on the secondary adapter.

Setting the context, drawing and swapping the buffers works one time, after that making the context current for the second window on the second adapter fails.

Creating windows on the primary adapter’s displays is not a problem and works as expected.

Worse even: the behaviour is not consistent, sometimes the wglMakeCurrent call fails on the second invocation for a DC of a window on the second adapter, other times it works for ages until it starts throwing errors again.

What would be the correct channels to approach with this problem? I gather since it seems to be ATI related i should contact ATI/AMD. Is there a developer program one can get in? I couldn’t find anything on their developers page.

Thanks a ton.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.