[SOLVED]Solid and Wireframe

Started by
7 comments, last by cNoob 18 years, 1 month ago
Hi everyone i was woundering how i would be able to change my render states so my world can be viewed in solid and wireframe. I have tryed the following but it doesnt seem to work. g_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME | D3DFILL_SOLID); Any help on how to use both wireframe and solid modes together would be great. I might be wrong maybe the wireframe is showing but it can not be seen because it has the same color as the primitive. So is there a way i can change the colour of the wireframe. Thanks. [Edited by - cNoob on March 11, 2006 4:31:51 PM]
Advertisement
You can't combine them like that. At least not in the December 2005 SDK (expect it is the same in Feb). D3DFILL_WIREFRAME = 2 and D3DFILL_SOLID = 3 so you are saying 2|3, which would be the same as saying 3 or D3DFILL_SOLID so it renders everything as a solid. I expect that the easiest way to do it is to first render your whole world in D3DFILL_SOLID then clear the zbuffer and render the world in D3DFILL_WIREFRAME.

EDIT: Please remember that rendering the world to times most likely will cause a drop in performance. There might be other ways but I don't know any (shaders maybe).
Use either g_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME) or g_pD3DDevice->SetRenderState(D3DRS_FILLMODE, SOLID), you can't have both at the same time.

The wireframe mode doesn't change any colors, it simply doesn't fill the triangles and just draws the edges.

Niko Suni

Thanks for the reply ill try your suggestion out.
If you want to have a wireframe rendered over your solid geometry you can render the objects once with a solid renderstate set and then again with a wireframe renderstate.

i.e.
g_pD3DDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
//Render Geometry
g_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
//Render Geometry

I hope this helps.
Take care.
Quote:Original post by Armadon
If you want to have a wireframe rendered over your solid geometry you can render the objects once with a solid renderstate set and then again with a wireframe renderstate.

i.e.
g_pD3DDevice->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
//Render Geometry
g_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
//Render Geometry

I hope this helps.
Take care.


In effect, if you want to actually see the wireframes on top of the solid triangles, you'll have to change some renderstates in between these operations (for example, material settings or blending state).

The polygons' edge colors stay exactly the same otherwise, regardless of the filling or the lack of it.

Niko Suni

yeh thats exactly what i want armadon but when i tryed it as Nick02 said you wont be able to see the wireframe as its just the same colours as the polygon. So what renderstates would i have to change so i can have my 3d scene then ontop a green wireframe. thanks.
You could, for example, render the wireframe by using a green material with no texture. Or, you could enable alpha blending, and perform some color mixing between the solid and wireframe renders.

The options are endless - just change something between the render passes that changes the colors of the pixels!

Niko Suni

Ok thanx for the help everyone ive now managed to get a green wirefrae over my scene. Thanks again.

This topic is closed to new replies.

Advertisement