Variations in Code and Markup

Although most of the simpler demonstrations of 3D in this book will be done in XAML, you can also do everything in code using your favorite .NET-compliant language. The following program is an enhanced version of Simple3DScene written in C#.

Example 1-2. Simple3DSceneInCode.cs

//---------------------------------------------------- // Simple3DSceneInCode.cs (c) 2007 by Charles Petzold //---------------------------------------------------- using System; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Media; using System.Windows.Media.Media3D; namespace Petzold.Simple3DSceneInCode { public class Simple3DSceneInCode : Window { PerspectiveCamera cam; [STAThread] ...

Get 3D Programming for Windows® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.