Charles petzold programming windows

3D Programming for Windows

Three-Dimensional Graphics Programming for the Windows Presentation Foundation

by
Charles Petzold

Die Kunst zu Programmieren («The Art of Programming») is the German edition of Programming in the Key of C#. Normally titles of foreign editions are similar to the English titles, but this one had to be changed because the pun no longer worked: The key of C# in music is known as cis in German. The book is available from Amazon.de.

3D Programming for Windows explores and elucidates the 3D graphics programming facilities of the Windows Presentation Foundation (WPF) under Windows Vista and the .NET Framework 3.0.

ISBN: 0-7356-2394-5; Microsoft Press; July 2007; 430 pages.

Availability

This book is available from:

  • Microsoft Press
  • Amazon.com
  • Barnes & Noble
  • BookSense.com

as well as many other real and virtual bookstores.

Table of Contents

  1. Lights! Camera! Mesh Geometries!
  2. Transforms and Animation
  3. Axis/Angle Rotation
  4. Light and Shading
  5. Texture and Materials
  6. Algorithmic Mesh Geometries
  7. Matrix Transforms
  8. Quaternions
  9. Applications and Curiosa

Source Code

For source code to programs in the book, go to the companion content page.

Information about this source code can be found in this blog entry.

The Petzold.Media3D library

The source code for the book includes version 0.9.0.0 of the Petzold.Media3D library (including source code). Purchase of the book entitles you to royalty-free use of the library in your own programs, including commercial applications. Please do not distribute the source code or a modified version of Petzold.Media3D.dll.

The latest version of the Petzold.Media3D library is version 0.9.1.0 and can be downloaded here:

To be informed for future updates, subscribe to the RSS feed of my blog for notifications of new versions.

Using the Book

To use the book, you will need to be running either Microsoft Windows Vista or Microsoft Windows XP with Service Pack 2 installed. You’ll also need Visual Studio 2005.

Step 1. Install the .NET Framework 3.0 Redistributable Package (also known as the Runtime Components) from here. You do not need to do this step if you’re running Windows Vista because the .NET Framework 3.0 is an intrinsic part of Vista.

Step 2. Install the .NET Software Development Kit from here. This is the big one! You can either download an ISO image to burn on a DVD, or run a Setup program that installs the SDK from the Web. The Web install is available here.

Step 3. Install the Visual Studio extensions for .NET 3.0 from here.

Step 4. The book presumes that you use the Empty Project option in Visual Studio. The .NET 3.0 extensions do not include an Empty Project option for WPF programming. To add this option, copy this WpfEmptyProject.zip file to the directory:

    \My Documents\Visual Studio 2005\Templates\ProjectTemplates\Visual C#

To create a new WPF empty project in Visual Studio, select the File | New Project item from the menu to display the New Project dialog. Select Visual C# at the left and then WPF Empty Project.

Something doesn’t look right? Check the Errata List. Errors are listed both by page number and in order of the date they’re submitted to me.

Something definitely isn’t right and it’s not listed? Send me an email at cp@charlespetzold.com.

Applications and Curiosa from Chapter 9

Chapter 9 of 3D Programming for Windows highlights several example applications that use 3D graphics. Source code for the three XBAPs (XAML Browser Applications) are available with the source code for the book. All programs require .NET 3.0.

Books by Charles Petzold

New edition of the classic book completely updated for for Windows 8.
Learn how to program new Windows Store applications using the
Windows Runtime, C# and XAML

Programming Windows Phone 7
(Microsoft Press, 2010)

Free thousand-page e-book now available!

The Annotated Turing
A Guided Tour through Alan Turing’s History Paper on Computability and the Turing Machine

(Wiley, 2008)
3D Programming for Windows
Three-Dimensional Graphics Programming for the Windows Presentation Foundation

(Microsoft Press, 2007)

An exploration and elucidation of the 3D programming facilities of the Windows Presentation Foundation.

For program source code, go to the companion content page, or download individual source code files from ftp://ftp.charlespetzold.com/3DProgWin or all source code files as 3DProgWin.zip (1.1M).

A free on-line 267-page book in PDF and XPS formats.

Applications = Code + Markup
A Guide to the Microsoft Windows Presentation Foundation

(Microsoft Press, 2006)

An introduction to the Microsoft Windows Presentation Foundation (formerly code-named Avalon), including XAML.

For program source code, go to the companion content page, or download individual source code files from ftp://ftp.charlespetzold.com/AppsCodeMarkup or all source code files as AppsCodeMarkup.zip (1.65M).

Programming Microsoft Windows Forms
(Microsoft Press, 2005; 384 pages)

An introduction to Windows Forms programming with an emphasis on .NET 2.0.

For program source code, go to the companion content page, or download individual source code files from ftp://ftp.charlespetzold.com/ProgWinForms or all source code files as ProgWinForms.zip (422K).

Programming in the Key of C#: A Primer for Aspiring Programmers
(Microsoft Press, 2003; 418 pages)

A tutorial for people wishing to learn the C# programming language. No prior programming knowledge is required.

For program source code, go to the companion content page, or download individual source code files from ftp://ftp.charlespetzold.com/ProgKeyCS or all source code files as ProgKeyCS.zip (203K).

Programming Microsoft Windows with C#
(Microsoft Press, 2001; 1290 pages)

A tutorial for programmers wishing to write applications for Windows using the C# programming language and the Windows Forms class library. Knowledge of C or C++ is required.

Download individual source code files from ftp://ftp.charlespetzold.com/ProgWinCS or all source code files as ProgWinCS.zip (684K).

Code: The Hidden Language of Computer Hardware and Software
(Microsoft Press, 1999; 393 pages)

A unique exploration into bits, bytes, and the inner workings of computers.

Programming Windows , 5 th edition
(Microsoft Press, 1998; 1479 pages)

A tutorial for programmers wishing to write applications for Windows using the C programming language and the native Win32 application programming interface (API). Programs written using this book run under every version of Windows from Windows 95 through Windows XP and beyond. Knowledge of C is required.

Download individual source code files and executables from ftp://ftp.charlespetzold.com/ProgWin5 or the complete CD as ProgWin5.zip (9.87M).

Out-of-Print Books

Programming Microsoft Windows with Microsoft Visual Basic .NET
(Microsoft Press, 2002; 1303 pages)

A tutorial for programmers wishing to write applications for Windows using Visual Basic .NET and the Windows Forms class library. This book is a translation of my book Programming Microsoft Windows with C# from the C# programming language to Visual Basic .NET.

For program source code, go to the Microsoft Press page and click Companion Content at the right, or download individual source code files and executables from ftp://ftp.charlespetzold.com/ProgWinVB or the complete CD as ProgWinVB.zip (709K).

The book is missing a table of colors on the inside back cover. Download it here.

If you compile programs on the command line, programs that use Visual Basic function such as Chr and ChrW require the additional Imports statement:

    Imports Microsoft.VisualBasic
Programming Windows, 4 th edition
(Microsoft Press, 1996; 1100 pages)

Download individual source code files and executables from ftp://ftp.charlespetzold.com/ProgWin95 or the complete diskette as ProgWin95.zip (1.06M). Chapters 12 and 20 contain material that I do not hold the copyright on and are not included.

OS/2 Presentation Manager Programming
(Ziff-Davis Press, 1994; 934 pages)

This book shows C programmers how to write applications for the OS/2 2.1 Presentation Manager. The book is an update of the Microsoft Press book Programming the OS/2 Presentation Manager. The earlier book was based on the 16-bit OS/2 1.1 environment; this one focuses on the 32-bit OS/2 2.1 environment. Download individual source code file from ftp://ftp.charlespetzold.com/OS2PM2Image, or the original contents of the companion diskette from ftp://ftp.charlespetzold.com/OS2PM2.

Programming Windows, 3rd edition
(Microsoft Press, 1992; 983 pages)

Download individual source code files and executables from ftp://ftp.charlespetzold.com/ProgWin31 or the complete diskette as ProgWin31.zip (488K).

Programming Windows, 2nd edition.
(Microsoft Press, 1990)

Download individual source code files and executables from ftp://ftp.charlespetzold.com/ProgWin30 or the complete diskette as ProgWin30.zip (401K).

Programming the OS/2 Presentation Manager
(Microsoft Press, 1989)

Download individual source code files and executables from ftp://ftp.charlespetzold.com/ProgOS2PM or the complete diskette as ProgOS2PM.zip (207K).

Programming Windows, 1st edition
(Microsoft Press, 1988; 852 pages)

Download individual source code files and executables from ftp://ftp.charlespetzold.com/ProgWin1 or the complete diskette as ProgWin1.zip (189K).

Copies of out-of-print books may be available from:
  • Advanced Book Exchange
  • Alibris
  • Barnes & Noble Rare, Secondhand & Out of Print
  • Bibliofind.com (links to amazon.com)
  • BookFinder.com (searches other new and used book sites)
  • Powell’s Books (new and used books)

as well as other real and virtual used-book stores.

Books That Were Never Published

Also known as Programming Graphics for Windows .

Charles petzold programming windows

Revisited C source code for Charles Petzold’s Programming Windows 5th Edition ISBN-10 157231995X

The 5th edition Programming Windows was published in 1998 in the era of Windows 98, Windows NT and Internet Explorer 4. There is a 6th edition, but this deals with later Windows technologies — the 5th edition was the last to deal with purely C programming. Many programmers learnt and many are learning Windows Programming from this huge tome and its various editions. An excellent work.

Purpose of this repository

This repository was created to give the author working code to transliterate into the rust language — the rusty fruit of this exercise being placed in the petzold-pw5e-rs repository.

Contents of this repository

The initial commit was the source code roughly «as is» from the original distribution from the book’s website.

  • The Microsoft .dep.dsp.dsw & .mak files and the Debug and Release folders were omitted.
  • Some of the files were renamed to
    • improve lexicographical sorting
    • avoid duplicate names
  • Duplicate files were eliminated. Using the C compiler and the development environment allows files to be used across multiple projects.

Updating C source code

As of 2018 Visual Studio 2017 Community Edition is being used. Some of the items below are being pursued with less enthusiasm is plenty of work chasing down superseded functions e.g. SetWindowLong/GetWindowLong

Using Visual Studio 2015 Community Edition.

  • Rename the chapter folder and project folder to improve lexicographical sorting and order the projects within a chapter as per the book.
  • Reformat code with Ctrl-K Ctrl-D
  • Windows 98 is no longer supported — remove any #define WINVER and GetVersion()
  • Apply any errata as per various errata refernces on the interweb. Jason Doucette’s errata are referred to on Charles Petzold’s own website and are well explained. There is another set of errata at Computer Science Lab.
  • Replace WinMain with _tWinMain using PTSTR for szCommand
  • There are no long pointers. 16 bit Windows is dead. Replace LPTSTR with PTSTR usw.
  • Use safe versions of functions susceptible to buffer overrun e.g. Replace _vsntprintf() with _vsntprintf_s()
  • Annote Function Parameters and Return Values (a Microsoft thing)
  • (void)fn for functions where return value is ignored.
  • Apply #define STRICT and #define WIN32_LEAN_AND_MEAN
  • #include and use its macros where suitable. Edit_GetSel() being an example of one to avoid.

There are no links to any websites or internet sources on this page. Links can go stale. A search engine is your friend.

Читайте также:  Mac os имена файлов кодировка
Оцените статью