# Wireframe with Direct 3D for testing purposes

## Recommended Posts

MariaW2006    122
I'm working on developing a simple 3D game engine just to learn more about things. I'm using Direct 3D and C. I'm not really a newbie i know how to program in C (a and a whole bunch of other languages) from Computer Science at university. I can do basic stuff with open GL, but i'm pretty new to Direct X especially Direct3D. What i want to know is is it possible to have it draw my verticies as a wireframe for testing purposes? I am loading my vertices into a position only type vertex buffer and I tried using DrawPrimitives to draw them, but this doesn't work. I assume this is because I haven't created any lights or told the renderer what colour to use, but i'm not sure how to do this with direct 3D. With open gl you can set the drawing color using GLColor calls. Is there an equivelent for Direct 3D? Maybe i should just re-write for open gl.

##### Share on other sites
HopeDagger    970
You can enable wireframe rendering with:

gDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);

Quote:
 With open gl you can set the drawing color using GLColor calls. Is there an equivelent for Direct 3D?

You'll need to allow for diffuse colour in your FVF definition, by ORing in D3DFVF_DIFFUSE. Eg.

const DWORD MyFVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE;

Quote:
 Maybe i should just re-write for open gl.

If you do feel more comfortable with OpenGL, and have no reason to use D3D, then maybe you should switch back. On the flip side, D3D is worth learning as well, if you give it the time. Things definitely function a lot differently, but your dedication may pay off in the end. :)

Good luck, irregardless of your choice.

##### Share on other sites
MariaW2006    122
Excellent i can now see my standard 1 metre cube cells so now i can use this code to write an editor and do my map.

it also helped to call EndScene before Present instead of the other way around.