Solid+Wireframe in the same time

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

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

Thank you, but can you detail a bit THOSE FACTORS

Clau

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

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.

Thanks alot, this is verry useful.
Claudiu