/// <summary> /// Initialize anything that needs it /// Runs once as the window starts /// </summary> protected override void OnLoad(EventArgs e) { base.OnLoad(e); FPSUpdate.Enabled = true; //Print OpenGL Information to the Console, for referance Console.WriteLine("OpenGL Version: " + GL.GetString(StringName.Version)); Console.WriteLine("GLSL Version: " + GL.GetString(StringName.ShadingLanguageVersion)); Console.WriteLine(GL.GetString(StringName.Vendor) + " - " + GL.GetString(StringName.Renderer)); GL.Enable(EnableCap.CullFace); //Initialize the Game Game = new PongGame(this.ClientSize); GameCamera = new Camera(this.Width, this.Height, 0.1f, 100.0f, new Camera.CameraInfo(new Vector3(0.0f, 0.0f, 19.0f), new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f))); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { MouseState lastMouse = Mouse.GetState(); Camera = new Camera(this); // side view: //Camera.Position = new Vector3(35f, 20f, 0f); //Camera.Target = Camera.Position + Vector3.Normalize(new Vector3(7, 4, 0)); // front view: // NOTE: i can't seem to get it looking behind wall1, so we're looking behind wall2 Camera.Position = new Vector3(0f, 17f, 36f); Camera.Target = Camera.Position + Vector3.Normalize(new Vector3(0, 4, 7)); this.Components.Add(Camera); Display = new Display(this); Display.DrawOrder = int.MaxValue; this.Components.Add(Display); DebugDrawer = new DebugDrawer(this); this.Components.Add(DebugDrawer); primitives[(int)Primitives.box] = new BoxPrimitive(GraphicsDevice); primitives[(int)Primitives.capsule] = new CapsulePrimitive(GraphicsDevice); primitives[(int)Primitives.cone] = new ConePrimitive(GraphicsDevice); primitives[(int)Primitives.cylinder] = new CylinderPrimitive(GraphicsDevice); primitives[(int)Primitives.sphere] = new SpherePrimitive(GraphicsDevice); BasicEffect = new BasicEffect(GraphicsDevice); BasicEffect.EnableDefaultLighting(); BasicEffect.PreferPerPixelLighting = true; base.Initialize(); }