本文整理汇总了C#中GraphicsContextFlags类的典型用法代码示例。如果您正苦于以下问题:C# GraphicsContextFlags类的具体用法?C# GraphicsContextFlags怎么用?C# GraphicsContextFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphicsContextFlags类属于命名空间,在下文中一共展示了GraphicsContextFlags类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:raphaelts3,项目名称:opentk,代码行数:41,代码来源:EglContext.cs
示例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;
}
}
开发者ID:renanyoy,项目名称:mono-opentk,代码行数:26,代码来源:iPhoneOSGraphicsContext.cs
示例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);
}
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:EglWinPlatformFactory.cs
示例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);
}
开发者ID:tanis2000,项目名称:FEZ,代码行数:27,代码来源:EglContext.cs
示例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);
}
开发者ID:dakahler,项目名称:alloclave,代码行数:35,代码来源:EglContext.cs
示例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);
}
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:7,代码来源:EglSdl2PlatformFactory.cs
示例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);
}
开发者ID:challal,项目名称:scallion,代码行数:7,代码来源:EglWinPlatformFactory.cs
示例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;
}
开发者ID:tanis2000,项目名称:FEZ,代码行数:7,代码来源:Utilities.cs
示例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);
}
开发者ID:dellis1972,项目名称:opentk,代码行数:7,代码来源:EglX11PlatformFactory.cs
示例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);
}
开发者ID:renanyoy,项目名称:mono-opentk,代码行数:8,代码来源:AndroidGraphicsContext.cs
示例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;
}
开发者ID:bosoni,项目名称:csat,代码行数:10,代码来源:BaseGame.cs
示例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);
}
开发者ID:PieterMarius,项目名称:PhysicsEngine,代码行数:11,代码来源:LinuxGraphicsContext.cs
示例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;
}
开发者ID:renanyoy,项目名称:mono-opentk,代码行数:20,代码来源:Utilities.iPhone.cs
示例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;
}
开发者ID:prepare,项目名称:HTML-Renderer,代码行数:12,代码来源:X11GLContext.cs
示例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();
}
开发者ID:prepare,项目名称:HTML-Renderer,代码行数:21,代码来源:GLControl.cs
示例16: GraphicsContext
public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
{
lock (GraphicsContext.SyncRoot)
{
bool local_0 = false;
if (mode == null && window == null)
{
local_0 = true;
}
else
{
if (mode == null)
throw new ArgumentNullException("mode", "Must be a valid GraphicsMode.");
if (window == null)
throw new ArgumentNullException("window", "Must point to a valid window.");
}
if (major <= 0)
major = 1;
if (minor < 0)
minor = 0;
IGraphicsContext local_1_1 = GraphicsContext.FindSharedContext();
if (local_0)
{
this.implementation = (IGraphicsContext) new DummyGLContext();
}
else
{
IPlatformFactory local_2 = (IPlatformFactory) null;
switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded)
{
case false:
local_2 = Factory.Default;
break;
case true:
local_2 = Factory.Embedded;
break;
}
this.implementation = local_2.CreateGLContext(mode, window, local_1_1, GraphicsContext.direct_rendering, major, minor, flags);
if (GraphicsContext.GetCurrentContext == null)
{
GraphicsContext.GetCurrentContextDelegate local_3 = local_2.CreateGetCurrentGraphicsContext();
if (local_3 != null)
GraphicsContext.GetCurrentContext = local_3;
}
}
GraphicsContext.available_contexts.Add(this.Context, new WeakReference((object) this));
}
}
开发者ID:tanis2000,项目名称:FEZ,代码行数:48,代码来源:GraphicsContext.cs
示例17: GraphicsContext
/// <summary>
/// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the specified window.
/// </summary>
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GraphicsContext.</param>
/// <param name="window">The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.</param>
/// <param name="major">The major version of the new GraphicsContext.</param>
/// <param name="minor">The minor version of the new GraphicsContext.</param>
/// <param name="flags">The GraphicsContextFlags for the GraphicsContext.</param>
/// <remarks>
/// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.
/// </remarks>
public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
{
lock (SyncRoot)
{
bool designMode = false;
if (mode == null && window == null)
designMode = true;
else if (mode == null) throw new ArgumentNullException("mode", "Must be a valid GraphicsMode.");
else if (window == null) throw new ArgumentNullException("window", "Must point to a valid window.");
// Silently ignore invalid major and minor versions.
if (major <= 0)
major = 1;
if (minor < 0)
minor = 0;
Debug.Print("Creating GraphicsContext.");
try
{
Debug.Indent();
Debug.Print("GraphicsMode: {0}", mode);
Debug.Print("IWindowInfo: {0}", window);
Debug.Print("GraphicsContextFlags: {0}", flags);
Debug.Print("Requested version: {0}.{1}", major, minor);
IGraphicsContext shareContext = shareContext = FindSharedContext();
// Todo: Add a DummyFactory implementing IPlatformFactory.
if (designMode)
implementation = new Platform.Dummy.DummyGLContext();
else
switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded)
{
case false: implementation = Factory.Default.CreateGLContext(mode, window, shareContext, direct_rendering, major, minor, flags); break;
case true: implementation = Factory.Embedded.CreateGLContext(mode, window, shareContext, direct_rendering, major, minor, flags); break;
}
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
}
finally
{
Debug.Unindent();
}
}
}
开发者ID:jcnossen,项目名称:upspring.net,代码行数:56,代码来源:GraphicsContext.cs
示例18: 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;
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.
Renderable = RenderableFlags.GL;
if ((flags & GraphicsContextFlags.Embedded) != 0)
{
Renderable = major > 1 ? RenderableFlags.ES2 : RenderableFlags.ES;
}
RenderApi api = (Renderable & RenderableFlags.GL) != 0 ? RenderApi.GL : RenderApi.ES;
Debug.Print("[EGL] Binding {0} rendering API.", api);
if (!Egl.BindAPI(api))
{
Debug.Print("[EGL] Failed to bind rendering API. Error: {0}", Egl.GetError());
}
Mode = new EglGraphicsMode().SelectGraphicsMode(window,
mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples,
mode.AccumulatorFormat, mode.Buffers, mode.Stereo,
Renderable);
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);
}
开发者ID:tecnikor,项目名称:opentk,代码行数:51,代码来源:EglContext.cs
示例19: DesktopViewController
public DesktopViewController(Type rootClass, int windowWidth, int windowHeight, string windowTitle,
GameWindowFlags windowFlags, DisplayDevice device, GraphicsContextFlags flags)
: base(windowWidth, windowHeight, GraphicsMode.Default, windowTitle, windowFlags, device, -1, -1, flags)
{
Console.WriteLine("Sparrow-sharp: Starting");
_rootClass = rootClass;
Load += HandleLoad;
RenderFrame += HandleRenderFrame;
Mouse.Move += OnMouseMove;
Mouse.ButtonDown += OnMouseButtonChange;
Mouse.ButtonUp += OnMouseButtonChange;
// Run the game at 60 updates per second
Run(60.0);
}
开发者ID:fmotagarcia,项目名称:sparrow-sharp,代码行数:18,代码来源:DesktopViewController.cs
示例20: Program
public Program(int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device,
int major, int minor, GraphicsContextFlags flags, IGraphicsContext sharedContext)
: base(width, height, title, options,
mode == null ? GraphicsMode.Default : mode,
device == null ? DisplayDevice.Default : device)
{
try
{
glContext = new GraphicsContext(mode == null ? GraphicsMode.Default : mode, WindowInfo, major, minor, flags);
glContext.MakeCurrent(WindowInfo);
(glContext as IGraphicsContextInternal).LoadAll();
}
catch (Exception e)
{
Debug.Print(e.ToString());
base.Dispose();
throw;
}
}
开发者ID:corefan,项目名称:awgraphics,代码行数:19,代码来源:Program.cs
注:本文中的GraphicsContextFlags类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论