views:

284

answers:

3

I am trying to render a model in Direct3D using DrawIndexedPrimitives. However, I am not able to see it on screen. What are the usual methods used to debug a Direct3D model?

I've tried the following:

  • Switched off back face culling
  • Used PrimitiveType.LineStrip instead of PrimitiveType.TriangleStrip
  • Several combinations of View and Projection matrices.
  • Used AutoCAD to plot the vertices as tiny spheres
+2  A: 

Use PIX tool from DX SDK. It's absolutely awesome.

Probably you'll want to use single frame capture mode. Then on the draw call PIX will show the model before vertex processing takes place, after vertex processing takes place, complete state of your device, resulting pixels rendered, etc.

NeARAZ
+1  A: 

By default there is no light in D3D, May be everything is black. Try do turn the light on if you didn't.

Emmanuel Caradec
+1  A: 
  • Make the background color grey; then if it's white or black you'll see it.
  • Check your transform matrices (world/view/projection). Use a standard math function for view & projection, set world to identity.
  • Make sure you setup your viewport; easy to forget this one and have 0 values in the viewport.
  • Turn on D3D debugging. Look at the debug spew; lots of people miss that the runtime will tell you what's going wrong.
  • Check your pixel/vertex shader. Use a known setup that works; or fixed function.
  • Check render state. Turn of Z buffering, Z test, Z write, etc in case you have depth setup problems. Check your color write masks are on. There are lots of states, look for ones you changed that might cause problems.
  • Check your call to DrawIP - you might have parameter problems such as specifiying the wrong number of vertices, faces, etc. Try drawing the first triangle in the list, and no others; get one to work before you draw them all...
cmaughan