andykorth / opentk

The Open Toolkit is a low-level C# library that wraps OpenGL, OpenCL and OpenAL. This fork has been superseded by https://github.com/thefiddler/opentk Please direct your attention to that official repository.
71 stars 27 forks source link

Modified windows version of GraphicsContext.MakeCurrent to correct issue which prevented multiple NativeWindows from rendering from a single context. #8

Closed david-lively closed 11 years ago

david-lively commented 11 years ago

...ultiple windows. This was mentioned in 2011 at

http://www.opentk.com/node/2474

When creating multiple windows (for instance, with a tiled rendering / display wall app) and a single context, only the first window would render. Attempting to call context.MakeCurrent() for any of the other windows would fail with an error 2000 (incorrect pixel format). This change corrects that, though the call to SetPixelFormat() is a bit slow.

david-lively commented 11 years ago

I'm not entirely happy with the GetPixelFormat() call - it should probably be cached as it has an effect on performance when calling MakeCurrent().

david-lively commented 11 years ago

Instead of creating NativeWindow's for multiple views, I'm now creating GameWindows and just don't call the .Run() method (my app maintains its own loop so that all of the windows can be updated in sequence). Closing this.