Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
CreateDummyContext throws an exception in 1.1 if there is no OpenTK context before #52
In 1.0, I used the method CreateDummyContext to share an external OpenGL context with OpenTK ones before any OpenTK context was created.
Now it does not work anymore, the method throws this exception:
A problem occurred: System.PlatformNotSupportedException: Operation is not supported on this platform.
If an OpenTK context is created before the call to CreateDummyContext, everything works fine.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
This is a regression from 1.0, will investigate.
You can use one of the following GraphicsContext constructors as a workaround:
// If you are using an external library that implements // its own context management (for example, SDL): var external_context = new GraphicsContext( new ContextHandle( /* IntPtr handle of external context */ ), (name) => /* GetProcAddress(name) from external library */, () => /* GetCurrentContext() from external library */); // If you wish to let OpenTK autodetect // how to retrieve the context through // WGL/GLX/AGL/CGL: var external_context = new GraphicsContext( ContextHandle.Zero, // retrieve handle of current context null); // reserved
Barring the present bug,
Note that the second method will only work on platforms with a native OpenTK backend. (Right now, this means desktop Windows, Linux/X11 and Mac OS X.) The first method will work everywhere.