From 3c867838e666a352d8f968177f72d2d5527ad387 Mon Sep 17 00:00:00 2001 From: "Stefanos A." Date: Thu, 3 Oct 2013 14:04:34 +0200 Subject: [PATCH] Reload WGL entry points in WinGLContext() This fixes AccessViolationException when creating multiple contexts on Intel hardware. --- Source/OpenTK/Platform/Windows/WinGLContext.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index 35e2f09f..0fc6fb82 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -64,7 +64,14 @@ namespace OpenTK.Platform.Windows lock (LoadLock) { - if (!wgl_loaded) + // On intel drivers, wgl entry points appear to change + // when creating multiple contexts. As a workaround, + // we reload Wgl entry points every time we create a + // new context - this solves the issue without any apparent + // side-effects (i.e. the old contexts can still be handled + // using the new entry points.) + // Sigh... + // if (!wgl_loaded) { // We need to create a temp context in order to load wgl extensions (e.g. for multisampling or GL3). // We cannot rely on OpenTK.Platform.Wgl until we create the context and call Wgl.LoadAll().