PDA

View Full Version : Solid+Wireframe in the same time



barsanpipu
01-31-2002, 05:07 AM
What I'm trying to obtain is thesimultaneous rendering of both Solid+Wireframe like in 3DStudioMax

I just wanna ask your oppinions on this ideea :

1) Draw the Smooth or Flat mesh
2) Disable Depth Testing
3) Draw with lines only those triangles that have a positive Z coordinateof the normal vector
4) Enable Depth testing again

Is there a simpler or faster method?

Thanx,
Clau http://www.opengl.org/discussion_boards/ubb/smile.gif

Eric
01-31-2002, 05:31 AM
What you usually do is:

1) Render objects in solid mode.
2) Enable GL_POLYGON_OFFSET (problem: the parameters for the offset may vary depending on a number of factors...).
3) Render objects in wireframe.
4) Disable GL_POLYGON_OFFSET.

This is actually a very easy way to do what you are looking for.

Regards.

Eric

barsanpipu
01-31-2002, 05:40 AM
Thank you, but can you detail a bit THOSE FACTORS

Clau

Pat
01-31-2002, 05:57 AM
The default parameters ,1.0 and 1.0, I believe work fine in most cases. You'll have to experiment to determine what parameter values work best for your app.

Pat

Eric
01-31-2002, 05:59 AM
I actually never had a problem with polygon offsets. I typically do:




glPolygonOffset(1,1);
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glEnable(GL_POLYGON_OFFSET_FILL);
SetMaterialsForFilled();
RenderObjects();
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
glDisable(GL_POLYGON_OFFSET_FILL);
SetMaterialsForLine();
RenderObjects();


Which is slightly different from what I explained in my previous post (i.e. I use polygon offset on the filled objects and not on the wireframe ones...).

I remember reading that you can get z-fighting between the solid/wireframe if you do not carefully choose the polygon offset parameters...

Don't know more about it, sorry...

Regards.

Eric

P.S.: if you search the forums for polygon offset, you'll certainly find more.

barsanpipu
01-31-2002, 06:08 AM
Thanks alot, this is verry useful.
Claudiu