Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / Trouble with a samples renders white. Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 26, 2005, 10:47 PM

I'm reading this book "Sams Managed DirectX 9 Kick Start Graphics And Game Programming"

And in the chapter 6 example...which is a 3d car game.

The car .X file renders as plain white, textureless i believe. However, when i view the mesh in the sdk "Mesh Viewer" program it is fully colored.

I have two questions...first is how do i get this thing to render the embeded color info, and second what kind of mesh is this...or the name of the technique that embeds the color information...i'm pretty new to directx...

here's the .X file


April 27, 2005, 12:06 AM


If your object is supposed to be textured, it is very likely that it's material color has been set to white. This is because the lighting is usualy computed with the vertex color and then is multiplied by the texture color (which contains the per-pixel diffuse color).

When you load a Mesh with some overloads of Mesh.FromFile() you are provided with an array of extendedMaterials. you have to parse them, load the texture yourself and store them somewhere. Then when yo will render the object you have to setup the right material before rendering each subset of the mesh in a little loop.

MSDN is your best friend:

this tutorial is simple and very well done, just follow the steps

I hope this helps,



April 27, 2005, 03:42 PM

Ok i figured it out...this is sorta my old vid cards fault.

If i run the authors completed version of the sample, the car is white...when inspecting the line where he checks if the device supports directional lights, he also makes sure MaxActiveLights is > 1. I guess my card is pretty old cause it returns -1...i'm not sure... anyway i took out the max lights check cause my card doesn't crash when i use a light so it must support some amount of lights...and done. the car is colored :P

This thread contains 3 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.