private static void Command_democubemapping(string[] parameters) { byte DemoCubemapping = ConsoleVarManager.GetValueToByte("DemoCubemapping"); if (DemoCubemapping == 0) { // Start DemoGlut; Make sure that the other demo is stopped ConsoleVarManager.SetOrCreate("DemoCubemapping", "1", 0); ConsoleVarManager.SetOrCreate("DemoFreeglut", "0", 0); ConsoleManager.WriteLine("Starting demo CUBEMAPPING..."); } else { // Stop DemoGlut ConsoleVarManager.SetOrCreate("DemoCubemapping", "0", 0); ConsoleVarManager.SetOrCreate("DemoFreeglut", "0", 0); ConsoleManager.WriteLine("Stopping demo CUBEMAPPING..."); } }
private static void Command_demogui(string[] parameters) { byte DemoGUI = ConsoleVarManager.GetValueToByte("DemoGUI"); if (DemoGUI == 0) { // Start demo; Make sure that the other demos are stopped ConsoleVarManager.SetOrCreate("DemoFreeglut", "0", 0); ConsoleVarManager.SetOrCreate("DemoCubemapping", "0", 0); ConsoleVarManager.SetOrCreate("DemoGUI", "1", 0); ConsoleManager.WriteLine("Starting demo GUI..."); } else { // Stop demo; ConsoleVarManager.SetOrCreate("DemoCubemapping", "0", 0); ConsoleVarManager.SetOrCreate("DemoFreeglut", "0", 0); ConsoleVarManager.SetOrCreate("DemoGUI", "0", 0); ConsoleManager.WriteLine("Stopping demo GUI..."); } }
public static void Reshape(int width, int height) { //Console.WriteLine("Reshape: {0}x{1}", width, height); if (width <= 0) { width = 1; } if (height <= 0) { height = 1; } ConsoleVarManager.SetOrCreate("ScreenWidth", width.ToString(), 0); ConsoleVarManager.SetOrCreate("ScreenHeight", height.ToString(), 0); ConsoleManager.Init(); SetupGL(); if (ConsoleManager.IsOpen) { GL.Viewport(0, 0, width, height); GL.MatrixMode(GL.GL_PROJECTION); GL.LoadIdentity(); GL.Ortho(0, width, height, 0, -4096, 4096); GL.MatrixMode(GL.GL_MODELVIEW); GL.LoadIdentity(); } else { if (ConsoleVarManager.GetValueToByte("DemoFreeglut") == 1) { float ratio = 0; float ortho = 30; GL.Viewport(0, 0, width, height); GL.MatrixMode(GL.GL_PROJECTION); GL.LoadIdentity(); if (width >= height) { ratio = (float)width / (float)height; GL.Ortho(-ortho * ratio, ortho * ratio, -ortho, ortho, -ortho, ortho); } else { ratio = (float)height / (float)width; GL.Ortho(-ortho, ortho, -ortho * ratio, ortho * ratio, -ortho, ortho); } GL.MatrixMode(GL.GL_MODELVIEW); GL.LoadIdentity(); } if (ConsoleVarManager.GetValueToByte("DemoCubemapping") == 1) { GL.Viewport(0, 0, width, height); // Set the viewport for the OpenGL window GL.MatrixMode(GL.GL_PROJECTION); GL.LoadIdentity(); GLU.Perspective(45.0, (float)width / (float)height, 1.0, 100.0); // Do the perspective calculations. Last value = max clipping depth GL.MatrixMode(GL.GL_MODELVIEW); GL.LoadIdentity(); } if (ConsoleVarManager.GetValueToByte("DemoGUI") == 1) { GL.Viewport(0, 0, width, height); GL.MatrixMode(GL.GL_PROJECTION); GL.LoadIdentity(); GL.Ortho(0, width, height, 0, -4096, 4096); GL.MatrixMode(GL.GL_MODELVIEW); GL.LoadIdentity(); } } }