From b777445c2bd57c5c2ef9d927390f64c0f05e936f Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 17 Aug 2013 18:31:49 -0400 Subject: [PATCH] provide support for automatically setting up OpenTK's gl context when creating an instance of SDLGL20 --- PortableGL.SDL/SDLGL20.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PortableGL.SDL/SDLGL20.cs b/PortableGL.SDL/SDLGL20.cs index 32e0531..fc140c2 100644 --- a/PortableGL.SDL/SDLGL20.cs +++ b/PortableGL.SDL/SDLGL20.cs @@ -1,10 +1,20 @@ using System; +using OpenTK.Graphics; using OpenTK.Graphics.OpenGL; namespace PortableGL.SDL { public class SDLGL20 : GL20 { + public SDLGL20(IntPtr glContext) + { + if (glContext == IntPtr.Zero) + throw new ArgumentNullException("glContext"); + + GraphicsContext.CurrentContext = glContext; + GL.LoadAll(); + } + public override void glActiveTexture(int texture) { GL.ActiveTexture((TextureUnit)texture);