Support external EGL contexts.

This commit is contained in:
the_fiddler 2009-11-04 17:00:52 +00:00
parent cc8ac7df14
commit 7f57d75570
4 changed files with 31 additions and 0 deletions

View file

@ -75,6 +75,17 @@ namespace OpenTK.Platform.Egl
MakeCurrent(window);
}
public EglContext(ContextHandle handle, EglWindowInfo window, IGraphicsContext sharedContext,
int major, int minor, GraphicsContextFlags flags)
{
if (handle == ContextHandle.Zero)
throw new ArgumentException("handle");
if (window == null)
throw new ArgumentNullException("window");
Handle = handle;
}
#endregion
#region IGraphicsContext Members

View file

@ -39,5 +39,10 @@ namespace OpenTK.Platform.Egl
{
throw new NotImplementedException();
}
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{
throw new NotImplementedException();
}
}
}

View file

@ -45,6 +45,14 @@ namespace OpenTK.Platform.Egl
return new EglContext(mode, egl_win, shareContext, major, minor, flags);
}
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{
WinWindowInfo win_win = (WinWindowInfo)window;
EGLDisplay egl_display = Egl.GetDisplay(EGLNativeDisplayType.Default); // Egl.GetDisplay(new EGLNativeDisplayType(win_win.DeviceContext));
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.WindowHandle, egl_display);
return new EglContext(handle, egl_win, shareContext, major, minor, flags);
}
public override IGraphicsMode CreateGraphicsMode()
{
return new EglGraphicsMode();

View file

@ -41,5 +41,12 @@ namespace OpenTK.Platform.Egl
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(new EGLNativeDisplayType(x11_win.Display)));
return new EglContext(mode, egl_win, shareContext, major, minor, flags);
}
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{
X11WindowInfo x11_win = (X11WindowInfo)window;
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(new EGLNativeDisplayType(x11_win.Display)));
return new EglContext(handle, egl_win, shareContext, major, minor, flags);
}
}
}