Charles Petzold



3D Graphics for Windows

August 3, 2007
Roscoe, N.Y.

I can trace my interest in computer graphics to a two-day Microsoft Windows Development Seminar held in New York City on June 5 and 6, 1986. Windows 1.0 had been released the previous fall, and Microsoft was trying to drum up interest in it. Similar events were held in other cities, and the existence of these development seminars was one reason why Windows eventually beat out its competitors, such as Gem and TopView.

On the first day of the event, Steve Ballmer (then Vice President Systems Software Group) kicked off the two days of presentations. We heard many of the designers and developers of Windows talk about the areas of Windows they had worked on. In two sessions on the morning of the second day, John Butler discussed the Windows Graphic Device Interface (GDI) and I was hooked. Ever since that day, graphics has been my favorite part of Windows programming.

On either the first or second day, Steve Ballmer took some questions, and I think it was this event — or maybe a similar event a year or two later — where someone asked if Windows would someday support 3D graphics. Ballmer indicated that his understanding was that in a practical sense, 3D was a hardware issue, and when the hardware became available, Windows would be there.

Although there have been some 3D APIs for Windows (most notably, in DirectX), Vista is the first version of Windows to have native support of 3D graphics as part of the Windows Presentation Foundation (WPF) class libraries. WPF is also available under XP with .NET 3.0 installed. Although Vista doesn't strictly require hardware assistance in a high-end graphics board, you need a good video board to get anti-aliasing in 3D.

What nobody, nobody, nobody could possibly have guessed in 1986 is that Windows would eventually support animated 3D graphics not only in conventional programming languages, but also in a non-procedural markup language called XAML. In fact, not many people at the time knew what a "markup language" was. 1986 was also the year in which IBM's Standard Generalized Markup Language or SGML — the basis of HTML, XML, and hence also XAML — became an ISO standard.

If you haven't yet seen how a 3D scene is defined in XAML, here's an example that shows off a few features. The file has more comments than you'll usually find in a XAML file (particularly those not created by human beings), so you may be able to get a sense of the role of the various chunks of markup.

WPF3D.xaml

If you're running Vista or Windows XP with .NET 3.0 installed, you should be able to launch that XAML file and view it in your browser. It displays a rotating cube with six sides in different colors. Alternatively, if you right-click the link, you should be able to download the file and view it in Notepad.

If you'd like to learn more, my new book 3D Programming for Windows is hot off the presses and eager to be read.

Buy my book and we'll both be happy!
Amazon.com BookSense.com quantumbooks
Barnes & Noble Amazon Canada Amazon UK
Amazon Français Amazon Deutsch Amazon Japan