/// <summary> /// Invoked after either control has created its graphics device. /// </summary> protected override void RaiseLoadContent(GraphicsDeviceEventArgs args) { // Create our 3D cube object Primitive.Initialize(args.GraphicsDevice); base.RaiseLoadContent(args); }
protected virtual void RaiseRenderXna(GraphicsDeviceEventArgs args) { var handler = RenderXna; if (handler != null) { handler(this, args); } }
protected virtual void RaiseLoadContent(GraphicsDeviceEventArgs args) { var handler = LoadContent; if (handler != null) { handler(this, args); } }
/// <summary> /// Invoked when our second control is ready to render. /// </summary> protected override void RaiseRenderXna(GraphicsDeviceEventArgs args) { args.GraphicsDevice.Clear(Color.LightGreen); if (Primitive != null) { // Create the world-view-projection matrices for the cube and camera Matrix world = Matrix.CreateFromYawPitchRoll(_yaw, _pitch, 0f); Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 2.5f), Vector3.Zero, Vector3.Up); Matrix projection = Matrix.CreatePerspectiveFieldOfView(1, args.GraphicsDevice.Viewport.AspectRatio, 1, 10); // Draw a cube Primitive.Draw(world, view, projection, Color); } base.RaiseRenderXna(args); }
protected virtual void RaiseRenderXna(GraphicsDeviceEventArgs args) { var handler = RenderXna; if (handler != null) handler(this, args); }
protected virtual void RaiseLoadContent(GraphicsDeviceEventArgs args) { var handler = LoadContent; if (handler != null) handler(this, args); }
/// <summary> /// Invoked after either control has created its graphics device. /// </summary> private void OnGraphicsControlLoadContent(object sender, GraphicsDeviceEventArgs e) { // Create our 3D cube object _cube.Initialize(e.GraphicsDevice); }