Thursday, September 06, 2007

DiffuseMaterial.Color vs DiffuseMaterial.Brush

I've been getting my feet wet with 3D in WPF lately, as I've been reading the new Petzold book 3D Programming for Windows.

It's too early to give any review of the book yet, but back to the subject matter:

As I was trying the examples out I was just getting emptiness !?! I suspected I had screwed up either the MeshGeometry.Positions and/or camera directions so those I checked first, and found no differences.

I looked at my code, and nothing jumped out as wrong.

When I looked closer I noticed that I'd been using DiffuseMaterial.Color instead of DiffuseMaterial.Brush

According to MSDN:

Brush: "Brush to be applied as a Material to a 3-D model."

Color: "The color allowed to emit from the Material. The default value is #FFFFFF. Since all colors make up white, all colors are visible by default."

Obviously? .Color was the wrong choice.

It seems I've got plenty to learn ...

No comments: