本文整理汇总了C#中OpenTK.GameWindow.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# GameWindow.Dispose方法的具体用法?C# GameWindow.Dispose怎么用?C# GameWindow.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenTK.GameWindow
的用法示例。
在下文中一共展示了GameWindow.Dispose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main()
{
// Create static (global) window instance
Window = new OpenTK.GameWindow();
// Hook up the initialize callback
Window.Load += new EventHandler<EventArgs>(Initialize);
// Hook up the update callback
Window.UpdateFrame += new EventHandler<FrameEventArgs>(Update);
// Hook up the render callback
Window.RenderFrame += new EventHandler<FrameEventArgs>(Render);
// Hook up the shutdown callback
Window.Unload += new EventHandler<EventArgs>(Shutdown);
// Set window title and size
Window.Title = "Game Name";
Window.ClientSize = new Size(30*8, 30*6);
Window.VSync = VSyncMode.On;
// Run the game at 60 frames per second. This method will NOT return
// until the window is closed.
Window.Run(60.0f);
// If we made it down here the window was closed. Call the windows
// Dispose method to free any resources that the window might hold
Window.Dispose();
#if DEBUG
Console.WriteLine("\nFinished executing, press any key to exit...");
Console.ReadKey();
#endif
}
示例2: Main
public static void Main()
{
//create static(global) window instance
Window = new OpenTK.GameWindow();
//hook up the initialize callback
Window.Load += new EventHandler<EventArgs>(Initialize);
//hook up the update callback
Window.UpdateFrame += new EventHandler<FrameEventArgs>(Update);
//hook up render callback
Window.RenderFrame += new EventHandler<FrameEventArgs>(Render);
//hook up shutdown callback
Window.Unload += new EventHandler<EventArgs>(Shutdown);
Window.VSync = VSyncMode.On;
//set window title and size
Window.Title = "Game Name";
Window.ClientSize = new Size(800, 600);
//run game at 60fps. will not return until window is closed
Window.Run(60.0f);
Window.Dispose();
#if DEBUG
Console.ReadLine();
#endif
}
示例3: Window
public Window(int Width, int Height, string Title, bool UseOGLThree = false)
{
var tempWindowForContext = new GameWindow(100, 100) { Visible = false };
GL.GetFloat(GetPName.MajorVersion, out major);
GL.GetFloat(GetPName.MinorVersion, out minor);
tempWindowForContext.Dispose();
Firefly.LatestAvailableVersion = (int)major * 10 + (int)minor;
GameWindow = new GameWindow(Width, Height,
new GraphicsMode(new ColorFormat(8, 8, 8, 8),//RGBA
8, 8, 8),//Depth, stencil, samples
Title,
GameWindowFlags.Default,//Fullscreen/windowed
DisplayDevice.Default, //Monitor
UseOGLThree ? 3 : 2, UseOGLThree ? 0 : 0, UseOGLThree ? GraphicsContextFlags.ForwardCompatible : GraphicsContextFlags.Default);//OGL version
GameWindow.VSync = VSyncMode.Off;
}
示例4: Main
public static void Main(string[] args) {
//create new window
Window = new MainGameWindow();
Axiis = new Grid();
TheGame = new CameraExample();
TheGame.Resize(Window.Width, Window.Height);
Window.Load += new EventHandler<EventArgs>(Initialize);
Window.UpdateFrame += new EventHandler<FrameEventArgs>(Update);
Window.RenderFrame += new EventHandler<FrameEventArgs>(Render);
Window.Unload += new EventHandler<EventArgs>(Shutdown);
Window.Title = "Game Name";
Window.ClientSize = new System.Drawing.Size(800, 600);
Window.VSync = VSyncMode.On;
//run 60fps
Window.Run(60.0f);
//Dispose at end
Window.Dispose();
}
示例5: CAdapter
public CAdapter()
{
var tempWindow = new GameWindow();
GraphicsMode bestMode = tempWindow.Context.GraphicsMode;
var tempContext = new Context(tempWindow.Context);
var implementation = tempContext.Implementation;
apiVersion = new ApiVersion((byte)implementation.MajorVersion, (byte)implementation.MinorVersion);
restrictions = new AdapterRestrictions
{
UniformBufferSlots = tempContext.Implementation.MaxUniformBufferBindings,
SamplerSlots = tempContext.Implementation.MaxCombinedTextureImageUnits, // todo Make those separate
ShaderResourceSlots = tempContext.Implementation.MaxCombinedTextureImageUnits,
UnorderedAccessResourceSlots = 0, // todo Set it
MaxVertexStreams = tempContext.Implementation.MaxVertexAttributes,
MaxVertexStreamElementCount = 16, // todo: set it
MaxStreamOutputTargets = tempContext.Implementation.MaxTransformFeedbackSeparateComponents, // todo: make sure
MaxViewports = tempContext.Implementation.MaxViewports,
MaxRenderTargets = tempContext.Implementation.MaxColorAttachments,
MaxThreadGroupsX = 0, // todo: set it,
MaxThreadGroupsY = 0, // todo: set it,
MaxThreadGroupsZ = 0, // todo: set it
MaxThreadGroupsTotal = 0
};
adapterDesc = new AdapterDescription
{
Description = GL.GetString(StringName.Renderer),
VendorId = 0,
DeviceId = 0,
SubSysId = 0,
Revision = 0,
DedicatedVideoMemory = 0,
DedicatedSystemMemory = 0,
SharedSystemMemory = 0,
AdapterLuidHigh = 0,
AdapterLuidLow = 0,
Flags = AdapterFlags.None
};
tempWindow.Dispose();
outputs = GetAvailableDisplays().Select((d, i) => new COutput(d, i)).ToArray();
//foreach (var format in DisplayColorFormats)
//{
// var expectedColorFormat = CtObjectGL.ColorFormat(format);
//
// tempWindow = new GameWindow(1, 1, new GraphicsMode(expectedColorFormat, bestMode.Depth, bestMode.Stencil));
// var actualColorFormat = tempWindow.Context.GraphicsMode.ColorFormat;
// tempWindow.Dispose();
//
// if (expectedColorFormat.Red == actualColorFormat.Red &&
// expectedColorFormat.Green == actualColorFormat.Green &&
// expectedColorFormat.Blue == actualColorFormat.Blue &&
// expectedColorFormat.Alpha == actualColorFormat.Alpha)
// {
// supportedDisplayFormats.Add(format);
// }
//}
}
示例6: Run
public void Run()
{
_gameWindow = new GameWindow(1280, 720);
try
{
_gameWindow.Title = "CubeHack";
_gameWindow.VSync = VSyncMode.On;
/* This sequence seems necessary to bring the window to the front reliably. */
_gameWindow.WindowState = WindowState.Maximized;
_gameWindow.WindowState = WindowState.Minimized;
_gameWindow.Visible = true;
_gameWindow.WindowState = WindowState.Maximized;
_gameWindow.KeyDown += OnKeyDown;
_gameWindow.KeyPress += OnKeyPress;
_gameWindow.KeyUp += OnKeyUp;
_gameLoop.RenderFrame += RenderFrame;
try
{
_gameLoop.Run(_gameWindow);
}
finally
{
_gameLoop.RenderFrame -= RenderFrame;
}
}
finally
{
_gameWindow.Dispose();
_gameWindow = null;
}
}