本文整理汇总了C#中Pencil.Gaming.GlfwWindowPtr.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# GlfwWindowPtr.Equals方法的具体用法?C# GlfwWindowPtr.Equals怎么用?C# GlfwWindowPtr.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pencil.Gaming.GlfwWindowPtr
的用法示例。
在下文中一共展示了GlfwWindowPtr.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: create
public static void create(int w, int h) {
Width = w;
Height = h;
AspectRatio = Width / (float) Height;
Glfw.WindowHint(WindowHint.Samples, 4);
Glfw.WindowHint(WindowHint.ContextVersionMajor, 3);
Glfw.WindowHint(WindowHint.ContextVersionMinor, 3);
Glfw.WindowHint(WindowHint.OpenGLForwardCompat, GL_TRUE);
Glfw.WindowHint(WindowHint.OpenGLProfile, OpenGLProfile.Core.GetHashCode());
GlfwVidMode[] modes = Glfw.GetVideoModes(Glfw.GetPrimaryMonitor());
Console.WriteLine("Displays");
foreach (GlfwVidMode mode in modes) {
Console.WriteLine(mode.Width + "x" + mode.Height + "\tr" + mode.RedBits + " g" + mode.GreenBits + " b" + mode.BlueBits + "\t " + mode.RefreshRate + "Hz");
}
GlfwVidMode defMode = Glfw.GetVideoMode(Glfw.GetPrimaryMonitor());
Console.WriteLine("Default Display\n" + defMode.Width + "x" + defMode.Height + "\tr" + defMode.RedBits + " g" + defMode.GreenBits + " b" + defMode.BlueBits + "\t " + defMode.RefreshRate + "Hz");
//Width = defMode.Width;
//Height = defMode.Height;
//window = Glfw.CreateWindow(Width, Height, title, Glfw.GetPrimaryMonitor(), GlfwWindowPtr.Null);
window = Glfw.CreateWindow(Width, Height, title, GlfwMonitorPtr.Null, GlfwWindowPtr.Null);
if (window.Equals(GlfwWindowPtr.Null)) {
Glfw.Terminate();
Console.WriteLine("Failed to create Window");
Console.WriteLine("Press Any Key to continue ...");
Console.ReadKey();
Environment.Exit(1);
}
Glfw.MakeContextCurrent(window);
}
示例2: AppMain
// the pragram starts here
private static void AppMain()
{
// initialize GLFW
if (!Glfw.Init())
throw new Exception("glfwInit failed");
// open a window with GLFW
Glfw.WindowHint(WindowHint.OpenGLProfile, (int)OpenGLProfile.Core);
Glfw.WindowHint(WindowHint.ContextVersionMajor, 3);
Glfw.WindowHint(WindowHint.ContextVersionMinor, 2);
_window = Glfw.CreateWindow(ScreenSize.X, ScreenSize.Y, "", GlfwMonitorPtr.Null, GlfwWindowPtr.Null);
if (_window.Equals(GlfwWindowPtr.Null))
throw new Exception("glfwOpenWindow failed. Can your hardware handle OpenGL 3.2?");
Glfw.MakeContextCurrent(_window);
// TODO: GLEW in C#
// print out some info about the graphics drivers
Console.WriteLine("OpenGL version: {0}", GL.GetString(StringName.Version));
Console.WriteLine("GLSL version: {0}", GL.GetString(StringName.ShadingLanguageVersion));
Console.WriteLine("Vendor: {0}", GL.GetString(StringName.Vendor));
Console.WriteLine("Renderer: {0}", GL.GetString(StringName.Renderer));
GL.Enable(EnableCap.DepthTest);
GL.DepthFunc(DepthFunction.Less);
// load vertex and fragment shaders into opengl
LoadShaders();
// load the texture
LoadTexture();
// create buffer and fill it with the points of the triangle
LoadCube();
double lastTime = Glfw.GetTime();
// run while window is open
while (!Glfw.WindowShouldClose(_window)) {
// update the scene based on the time elapsed since last update
double thisTime = Glfw.GetTime();
Update(thisTime - lastTime);
lastTime = thisTime;
// draw one frame
Render();
}
// clean up and exit
Glfw.Terminate();
}
示例3: AppMain
// the pragram starts here
private static void AppMain()
{
// initialize GLFW
if (!Glfw.Init())
throw new Exception("glfwInit failed");
// open a window with GLFW
Glfw.WindowHint(WindowHint.OpenGLProfile, (int)OpenGLProfile.Core);
Glfw.WindowHint(WindowHint.ContextVersionMajor, 3);
Glfw.WindowHint(WindowHint.ContextVersionMinor, 2);
_window = Glfw.CreateWindow(ScreenSize.X, ScreenSize.Y, "", GlfwMonitorPtr.Null, GlfwWindowPtr.Null);
if (_window.Equals(GlfwWindowPtr.Null))
throw new Exception("glfwOpenWindow failed. Can your hardware handle OpenGL 3.2?");
Glfw.MakeContextCurrent(_window);
// GLFW settings
Glfw.SetInputMode(_window, InputMode.CursorMode, CursorMode.CursorHidden | CursorMode.CursorCaptured);
Glfw.SetCursorPos(_window, 0, 0);
Glfw.SetScrollCallback(_window, new GlfwScrollFun((win, x, y) => {
//increase or decrease field of view based on mouse wheel
float zoomSensitivity = -0.2f;
float fieldOfView = _gCamera.FieldOfView + zoomSensitivity * (float)y;
if (fieldOfView < 5.0f) fieldOfView = 5.0f;
if (fieldOfView > 130.0f) fieldOfView = 130.0f;
_gCamera.FieldOfView = fieldOfView;
}));
// TODO: GLEW in C#
// print out some info about the graphics drivers
Console.WriteLine("OpenGL version: {0}", GL.GetString(StringName.Version));
Console.WriteLine("GLSL version: {0}", GL.GetString(StringName.ShadingLanguageVersion));
Console.WriteLine("Vendor: {0}", GL.GetString(StringName.Vendor));
Console.WriteLine("Renderer: {0}", GL.GetString(StringName.Renderer));
GL.Enable(EnableCap.DepthTest);
GL.DepthFunc(DepthFunction.Less);
// initialise the gWoodenCrate asset
LoadWoodenCrateAsset();
// create all the instances in the 3D scene based on the gWoodenCrate asset
CreateInstances();
_gCamera.Position = new Vector3(-4, 0, 17);
_gCamera.ViewportAspectRatio = (float)ScreenSize.X / (float)ScreenSize.Y;
_gCamera.SetNearAndFarPlanes(0.5f, 100.0f);
// setup light
_gLight = new Light() {
Position = _gCamera.Position,
Intensities = new Vector3(1, 1, 1), // white
Attenuation = 0.2f,
AmbientCoefficient = 0.005f
};
float lastTime = (float)Glfw.GetTime();
// run while window is open
while (!Glfw.WindowShouldClose(_window)) {
// update the scene based on the time elapsed since last update
float thisTime = (float)Glfw.GetTime();
Update(thisTime - lastTime);
lastTime = thisTime;
// draw one frame
Render();
//exit program if escape key is pressed
if (Glfw.GetKey(_window, Key.Escape))
Glfw.SetWindowShouldClose(_window, true);
}
// clean up and exit
Glfw.Terminate();
}
示例4: AppMain
// the pragram starts here
private static void AppMain()
{
// initialize GLFW
if (!Glfw.Init())
throw new Exception("glfwInit failed");
// open a window with GLFW
Glfw.WindowHint(WindowHint.OpenGLProfile, (int)OpenGLProfile.Core);
Glfw.WindowHint(WindowHint.ContextVersionMajor, 3);
Glfw.WindowHint(WindowHint.ContextVersionMinor, 2);
_window = Glfw.CreateWindow(ScreenSize.X, ScreenSize.Y, "", GlfwMonitorPtr.Null, GlfwWindowPtr.Null);
if (_window.Equals(GlfwWindowPtr.Null))
throw new Exception("glfwOpenWindow failed. Can your hardware handle OpenGL 3.2?");
Glfw.MakeContextCurrent(_window);
// GLFW settings
Glfw.SetInputMode(_window, InputMode.CursorMode, CursorMode.CursorHidden | CursorMode.CursorCaptured);
Glfw.SetCursorPos(_window, 0, 0);
Glfw.SetScrollCallback(_window, new GlfwScrollFun((win, x, y) => {
//increase or decrease field of view based on mouse wheel
float zoomSensitivity = -0.2f;
float fieldOfView = _gCamera.FieldOfView + zoomSensitivity * (float)y;
if (fieldOfView < 5.0f) fieldOfView = 5.0f;
if (fieldOfView > 130.0f) fieldOfView = 130.0f;
_gCamera.FieldOfView = fieldOfView;
}));
// TODO: GLEW in C#
// print out some info about the graphics drivers
Console.WriteLine("OpenGL version: {0}", GL.GetString(StringName.Version));
Console.WriteLine("GLSL version: {0}", GL.GetString(StringName.ShadingLanguageVersion));
Console.WriteLine("Vendor: {0}", GL.GetString(StringName.Vendor));
Console.WriteLine("Renderer: {0}", GL.GetString(StringName.Renderer));
GL.Enable(EnableCap.DepthTest);
GL.DepthFunc(DepthFunction.Less);
// load vertex and fragment shaders into opengl
LoadShaders();
// load the texture
LoadTexture();
// create buffer and fill it with the points of the triangle
LoadCube();
_gCamera.Position = new Vector3(0, 0, 4);
_gCamera.ViewportAspectRatio = (float)ScreenSize.X / (float)ScreenSize.Y;
double lastTime = Glfw.GetTime();
// run while window is open
while (!Glfw.WindowShouldClose(_window)) {
// update the scene based on the time elapsed since last update
double thisTime = Glfw.GetTime();
Update(thisTime - lastTime);
lastTime = thisTime;
// draw one frame
Render();
//exit program if escape key is pressed
if (Glfw.GetKey(_window, Key.Escape))
Glfw.SetWindowShouldClose(_window, true);
}
// clean up and exit
Glfw.Terminate();
}