Support external EGL contexts.
This commit is contained in:
parent
cc8ac7df14
commit
7f57d75570
4 changed files with 31 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue