本文整理汇总了C#中IGraphicsContext类的典型用法代码示例。如果您正苦于以下问题:C# IGraphicsContext类的具体用法?C# IGraphicsContext怎么用?C# IGraphicsContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGraphicsContext类属于命名空间,在下文中一共展示了IGraphicsContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: SampleBrowser
public SampleBrowser(Context context, IGraphicsContext graphicsContext, IWindowInfo windowInfo)
{
// TODO: Complete member initialization
this.androidContext = context;
this.GLGraphicsContext = graphicsContext;
this.GlWindowInfo = windowInfo;
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:7,代码来源:SampleBrowser.Droid.cs
示例3: CreateContext
public void CreateContext(bool direct, IGraphicsContext source)
{
if (!(this.Handle == ContextHandle.Zero))
return;
++DummyGLContext.handle_count;
this.Handle = new ContextHandle((IntPtr) DummyGLContext.handle_count);
}
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:DummyGLContext.cs
示例4: CreateProgram
public static ShaderProgram CreateProgram(IGraphicsContext context, string vertexSource, string fragmentSource)
{
int vertID = context.CreateShader(ShaderType.VertexShader);
int fragID = context.CreateShader(ShaderType.FragmentShader);
context.ShaderSource(vertID, vertexSource);
context.ShaderSource(fragID, fragmentSource);
context.CompileShader(vertID);
context.CompileShader(fragID);
Debug.LogInfo(context.GetShaderInfoLog(vertID));
Debug.LogInfo(context.GetShaderInfoLog(fragID));
int programID = context.CreateProgram();
context.AttachShader(programID, vertID);
context.AttachShader(programID, fragID);
context.LinkProgram(programID);
Debug.LogInfo(context.GetProgramInfoLog(programID));
return new ShaderProgram(context, vertID, fragID, programID);
}
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:25,代码来源:ShaderProgram.cs
示例5: 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
示例6: DeleteAll
/// <summary>
/// 現在のコンテキストが持つテクスチャをすべて削除します。
/// </summary>
/// <remarks>
/// OpenGLの終了時に呼ばれます。
/// </remarks>
public static void DeleteAll(IGraphicsContext context)
{
//var context = context;
lock (textureListSync)
{
for (int index = 0; index < textureList.Count; )
{
var texture = textureList[index].Target as Texture;
if (texture == null)
{
// 要素を削除したため、indexの更新は行いません。
textureList.RemoveAt(index);
continue;
}
if (texture.Context == context)
{
// テクスチャを削除
texture.Destroy();
// 要素を削除したため、indexの更新は行いません。
textureList.RemoveAt(index);
continue;
}
index += 1;
}
}
}
开发者ID:leontius,项目名称:Ragnarok,代码行数:35,代码来源:Texture.cs
示例7: AglContext
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext,
GetInt xoffset, GetInt yoffset)
{
Debug.Print("Share context: {0}", shareContext);
Debug.Print("Window info: {0}", window);
IntPtr shareContextRef = IntPtr.Zero;
XOffset = xoffset;
YOffset = yoffset;
carbonWindow = window;
if (shareContext is AglContext)
{
shareContextRef = ((AglContext)shareContext).Handle.Handle;
}
else if (shareContext is GraphicsContext)
{
ContextHandle shareHandle = shareContext != null ? (shareContext as IGraphicsContextInternal).Context : (ContextHandle)IntPtr.Zero;
shareContextRef = shareHandle.Handle;
}
if (shareContextRef == IntPtr.Zero)
{
Debug.Print("No context sharing will take place.");
}
CreateContext(mode, carbonWindow, shareContextRef, true);
}
开发者ID:nagyist,项目名称:opentk,代码行数:29,代码来源:AglContext.cs
示例8: QueueRenderCommands
public override void QueueRenderCommands(GameTime gameTime, Renderer renderer, IGraphicsContext context)
{
List<TerrainNode> nodesToRender = new List<TerrainNode>();
renderer.EnqueueLight(dlight);
// todo: maybe can parallelize
for (int i = 0; i < rootNodes.Length; i++)
{
if (rootNodes[i] != null)
{
List<TerrainNode> nodesFromThisCubeFace = new List<TerrainNode>();
findNodesToRender(nodesFromThisCubeFace, rootNodes[i], context.CurrentCamera);
nodesToRender.AddRange(nodesFromThisCubeFace);
}
}
int nodeCount = nodesToRender.Count;
NodeCount = nodeCount;
if (nodeCount > 0)
{
TerrainVertex[] vertices = nodesToRender.SelectMany(node => node.Geometry).ToArray();
var command = GenerateRenderCommand();
(command as RenderDeferredCommand<TerrainVertex>).NumVertices = vertices.Length;
vertexBuffer.SetData(vertices);
renderer.EnqueueDeferred(command as IRenderDeferredCommand);
}
}
开发者ID:ukitake,项目名称:Stratum,代码行数:30,代码来源:PlanetComponent.cs
示例9: AglContext
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext)
{
Debug.Print("Context Type: {0}", shareContext);
Debug.Print("Window info: {0}", window);
this.graphics_mode = mode;
this.carbonWindow = (CarbonWindowInfo)window;
if (shareContext is AglContext)
shareContextRef = ((AglContext)shareContext).Handle.Handle;
if (shareContext is GraphicsContext)
{
ContextHandle shareHandle = shareContext != null ?
(shareContext as IGraphicsContextInternal).Context : (ContextHandle)IntPtr.Zero;
shareContextRef = shareHandle.Handle;
}
if (shareContextRef == IntPtr.Zero)
{
Debug.Print("No context sharing will take place.");
}
CreateContext(mode, carbonWindow, shareContextRef, true);
}
开发者ID:dakahler,项目名称:alloclave,代码行数:25,代码来源:AglContext.cs
示例10: 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
示例11: 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
示例12: VertexBuffer
public VertexBuffer(IGraphicsContext context, BufferUsageHint hint)
{
this.GraphicsContext = context;
this.hint = hint;
this.GraphicsContext.GenBuffers(1, out Handle);
}
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:7,代码来源:VertexBuffer.cs
示例13: RenderManager
protected RenderManager(IGraphicsContext graphics)
{
_graphics = graphics;
// todo: subscribe to changes to asset libraries and build a dirty list for each library which will be processed on the next call to UpdateAssets. also observe changes to group dormancy.
// 1. if a mesh has been removed, check the asset group and if it's empty, destroy the buffer. ignore removed meshes; we'll leave them in place for performance reasons.
// 2. if a mesh has been added or updated, rebuild the buffer for now. later we may be able to optimise to do in-place buffer updates if it's an issue, but it probably won't be.
}
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:7,代码来源:RenderManager.cs
示例14: Draw
public override void Draw(IGraphicsContext gc)
{
int depth = CountParentDepth ();
Color color = _Colors [depth]; // CountParentDepth is expensive - so don't call ComponentColor here...
Color contactColor = color;
if (IsNotEmptyString (TypeName) == false)
{
color = Color.Crimson;
}
if (IsNotEmptyString (Name) == false)
{
color = Color.Red;
}
gc.Color = color;
DrawComponent (gc, _Bounds.Left, _Bounds.Top, _Bounds.Width, _Bounds.Height, 20, 2+depth, color);
gc.Color = contactColor;
gc.Thickness = 2 + depth;
if (Selected)
{
foreach (IGlyph contact in ContactPoints)
{
contact.Draw (gc);
}
}
}
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:26,代码来源:ComponentGlyph.cs
示例15: FreeMovementRenderableAsset
public FreeMovementRenderableAsset(IGraphicsContext context)
{
_texture = context.LoadTexture2D("freeMovementWidget");
_boundingBox = new AxisAlignedBoundingBox2D(0, 0, _texture.Height, _texture.Width);
RenderingOffset = -AABoundingBox.Center;
Origin = AABoundingBox.Center;
}
开发者ID:TiagoJSM,项目名称:Storytime,代码行数:7,代码来源:FreeMovementRenderableAsset.cs
示例16: 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
示例17: 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
示例18: RotateWidgetRenderableAsset
public RotateWidgetRenderableAsset(IGraphicsContext context)
{
_texture = context.LoadTexture2D("RotationWidget");
_boundingBox = new AxisAlignedBoundingBox2D(0, 0, _texture.Height, _texture.Width);
RenderingOffset = - _boundingBox.Center;
Origin = _boundingBox.Center;
}
开发者ID:TiagoJSM,项目名称:Storytime,代码行数:7,代码来源:RotateWidgetRenderableAsset.cs
示例19: 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
示例20: 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
注:本文中的IGraphicsContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论