本文整理汇总了C#中GraphicsContextFlags类的典型用法代码示例。如果您正苦于以下问题:C# GraphicsContextFlags类的具体用法?C# GraphicsContextFlags怎么用?C# GraphicsContextFlags使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphicsContextFlags类属于命名空间,在下文中一共展示了GraphicsContextFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EglContext
int swap_interval = 1; // Default interval is defined as 1 in EGL.
#endregion
#region Constructors
public EglContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
int major, int minor, GraphicsContextFlags flags)
{
if (mode == null)
throw new ArgumentNullException("mode");
if (window == null)
throw new ArgumentNullException("window");
EglContext shared = (EglContext)sharedContext;
int dummy_major, dummy_minor;
if (!Egl.Initialize(window.Display, out dummy_major, out dummy_minor))
throw new GraphicsContextException(String.Format("Failed to initialize EGL, error {0}.", Egl.GetError()));
WindowInfo = window;
// Select an EGLConfig that matches the desired mode. We cannot use the 'mode'
// parameter directly, since it may have originated on a different system (e.g. GLX)
// and it may not support the desired renderer.
Mode = new EglGraphicsMode().SelectGraphicsMode(mode.ColorFormat,
mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat,
mode.Buffers, mode.Stereo,
major > 1 ? RenderableFlags.ES2 : RenderableFlags.ES);
if (!Mode.Index.HasValue)
throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");
IntPtr config = Mode.Index.Value;
if (window.Surface == IntPtr.Zero)
window.CreateWindowSurface(config);
int[] attrib_list = new int[] { Egl.CONTEXT_CLIENT_VERSION, major, Egl.NONE };
HandleAsEGLContext = Egl.CreateContext(window.Display, config, shared != null ? shared.HandleAsEGLContext : IntPtr.Zero, attrib_list);
MakeCurrent(window);
}
示例2: iPhoneOSGraphicsContext
internal iPhoneOSGraphicsContext(ContextHandle handle, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags)
{
// ignore mode, window
iPhoneOSGraphicsContext shared = sharedContext as iPhoneOSGraphicsContext;
EAGLRenderingAPI version = 0;
if (major == 1 && minor == 1)
version = EAGLRenderingAPI.OpenGLES1;
else if (major == 2 && minor == 0)
version = EAGLRenderingAPI.OpenGLES2;
else if (major == 3 && minor == 0)
version = EAGLRenderingAPI.OpenGLES3;
else
throw new ArgumentException (string.Format("Unsupported GLES version {0}.{1}.", major, minor));
if (handle.Handle == IntPtr.Zero) {
EAGLContext = shared != null && shared.EAGLContext != null
? new EAGLContext(version, shared.EAGLContext.ShareGroup)
: new EAGLContext(version);
contextHandle = new ContextHandle(EAGLContext.Handle);
} else {
EAGLContext = (EAGLContext) Runtime.GetNSObject (handle.Handle);
contextHandle = handle;
}
}
示例3: CreateGLContext
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{
WinWindowInfo winWindowInfo = (WinWindowInfo) window;
IntPtr display = this.GetDisplay(winWindowInfo.DeviceContext);
EglWindowInfo window1 = new EglWindowInfo(winWindowInfo.WindowHandle, display);
return (IGraphicsContext) new EglContext(handle, window1, shareContext, major, minor, flags);
}
示例4: EglContext
public EglContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags)
{
if (mode == null)
throw new ArgumentNullException("mode");
if (window == null)
throw new ArgumentNullException("window");
EglContext eglContext = (EglContext) sharedContext;
int major1;
int minor1;
if (!Egl.Initialize(window.Display, out major1, out minor1))
throw new GraphicsContextException(string.Format("Failed to initialize EGL, error {0}.", (object) Egl.GetError()));
this.WindowInfo = window;
this.Mode = new EglGraphicsMode().SelectGraphicsMode(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo, major > 1 ? RenderableFlags.ES2 : RenderableFlags.ES);
if (!this.Mode.Index.HasValue)
throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");
IntPtr config = this.Mode.Index.Value;
if (window.Surface == IntPtr.Zero)
window.CreateWindowSurface(config);
int[] attrib_list = new int[3]
{
12440,
major,
12344
};
this.HandleAsEGLContext = Egl.CreateContext(window.Display, config, eglContext != null ? eglContext.HandleAsEGLContext : IntPtr.Zero, attrib_list);
this.MakeCurrent((IWindowInfo) window);
}
示例5: EglContext
bool vsync = true; // Default vsync value is defined as 1 (true) in EGL.
#endregion
#region Constructors
public EglContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
int major, int minor, GraphicsContextFlags flags)
{
if (mode == null)
throw new ArgumentNullException("mode");
if (window == null)
throw new ArgumentNullException("window");
EglContext shared = (EglContext)sharedContext;
int dummy_major, dummy_minor;
if (!Egl.Initialize(window.Display, out dummy_major, out dummy_minor))
throw new GraphicsContextException(String.Format("Failed to initialize EGL, error {0}.", Egl.GetError()));
WindowInfo = window;
Mode = new EglGraphicsMode().SelectGraphicsMode(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo);
if (!Mode.Index.HasValue)
throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");
IntPtr config = Mode.Index.Value;
if (window.Surface == IntPtr.Zero)
window.CreateWindowSurface(config);
int[] attrib_list = new int[] { Egl.CONTEXT_CLIENT_VERSION, major, Egl.NONE };
HandleAsEGLContext = Egl.CreateContext(window.Display, config, shared != null ? shared.HandleAsEGLContext : IntPtr.Zero, attrib_list);
MakeCurrent(window);
}
示例6: CreateGLContext
public override OpenTK.Graphics.IGraphicsContext CreateGLContext(
GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering,
int major, int minor, GraphicsContextFlags flags)
{
flags |= GraphicsContextFlags.Embedded;
return base.CreateGLContext(mode, window, shareContext, directRendering, major, minor, flags);
}
示例7: CreateGLContext
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{
WinWindowInfo win_win = (WinWindowInfo)window;
IntPtr egl_display = GetDisplay(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);
}
示例8: CreateGraphicsContext
public static IGraphicsContext CreateGraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
{
GraphicsContext graphicsContext = new GraphicsContext(mode, window, major, minor, flags);
graphicsContext.MakeCurrent(window);
graphicsContext.LoadAll();
return (IGraphicsContext) graphicsContext;
}
示例9: CreateGLContext
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(x11_win.Display));
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(new IntPtr(0)));
return new EglContext(handle, egl_win, shareContext, major, minor, flags);
}
示例10: AndroidGraphicsContext
public AndroidGraphicsContext (GraphicsMode mode, IWindowInfo window, IGraphicsContext sharedContext,
int major, int minor, GraphicsContextFlags flags)
{
if (major < 1 || major > 3)
throw new ArgumentException (string.Format("Unsupported GLES version {0}.{1}.", major, minor));
Init (mode, window, sharedContext, major, minor, flags);
}
示例11: BaseGame
public BaseGame(string projectName, int glVersionMajor, int glVersionMinor, GraphicsContextFlags flags)
: base(Settings.Width, Settings.Height,
new GraphicsMode(Settings.Bpp, Settings.DepthBpp, 0, Settings.FSAA, 0, 2, false),
projectName, 0, DisplayDevice.Default,
glVersionMajor, glVersionMinor,
flags)
{
Init();
Running = true;
}
示例12: LinuxGraphicsContext
public LinuxGraphicsContext(GraphicsMode mode, LinuxWindowInfo window, IGraphicsContext sharedContext,
int major, int minor, GraphicsContextFlags flags)
: base(mode, window, sharedContext, major, minor, flags)
{
if (mode.Buffers < 1)
throw new ArgumentException();
fd = window.FD;
PageFlip = HandlePageFlip;
PageFlipPtr = Marshal.GetFunctionPointerForDelegate(PageFlip);
}
示例13: CreateGraphicsContext
/// <summary>
/// Creates an IGraphicsContext instance for the specified window.
/// </summary>
/// <param name="mode">The GraphicsMode for the GraphicsContext.</param>
/// <param name="window">An IWindowInfo instance describing the parent window for this IGraphicsContext.</param>
/// <param name="major">The major OpenGL version number for this IGraphicsContext.</param>
/// <param name="minor">The minor OpenGL version number for this IGraphicsContext.</param>
/// <param name="flags">A bitwise collection of GraphicsContextFlags with specific options for this IGraphicsContext.</param>
/// <returns>A new IGraphicsContext instance.</returns>
public static IGraphicsContext CreateGraphicsContext(
GraphicsMode mode, IWindowInfo window,
int major, int minor, GraphicsContextFlags flags)
{
GraphicsContext context = new GraphicsContext(mode, window, major, minor, flags);
context.MakeCurrent(window);
(context as IGraphicsContextInternal).LoadAll();
return context;
}
示例14: X11GLContext
public X11GLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shared, bool direct,
int major, int minor, GraphicsContextFlags flags)
: base(DesktopBackend.OpenGL)
{
if (handle == ContextHandle.Zero)
throw new ArgumentException("handle");
if (window == null)
throw new ArgumentNullException("window");
Handle = handle;
currentWindow = (X11WindowInfo)window;
Display = currentWindow.Display;
}
示例15: GLControl
/// <summary>
/// Constructs a new GLControl with the specified GraphicsMode.
/// </summary>
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the control.</param>
/// <param name="major">The major version for the OpenGL GraphicsContext.</param>
/// <param name="minor">The minor version for the OpenGL GraphicsContext.</param>
/// <param name="flags">The GraphicsContextFlags for the OpenGL GraphicsContext.</param>
public GLControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags)
{
if (mode == null)
throw new ArgumentNullException("mode");
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
DoubleBuffered = false;
this.format = mode;
this.major = major;
this.minor = minor;
this.flags = flags;
InitializeComponent();
}