Sign in to follow this  
cNoob

[SOLVED]Solid and Wireframe

Recommended Posts

cNoob    295
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]

Share this post


Link to post
Share on other sites
CTar    1134
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).

Share this post


Link to post
Share on other sites
Nik02    4348
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.

Share this post


Link to post
Share on other sites
Armadon    1091
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.

Share this post


Link to post
Share on other sites
Nik02    4348
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.

Share this post


Link to post
Share on other sites
cNoob    295
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.

Share this post


Link to post
Share on other sites
Nik02    4348
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!

Share this post


Link to post
Share on other sites
cNoob    295
Ok thanx for the help everyone ive now managed to get a green wirefrae over my scene. Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this