it would help if you could detail what effect you’re after. if this is some sort of selection outline for a solid in an editor, i’ve never really come up with anything satisfactory. i’ve played with stippled lines, texmapped lines, plain old lines, wireframe solid lines, green eggs and lines… nothing quite suits me. i like the texmapped lines the best, i think, for selection anyway.
yeah, that’s z-fighting, and it’s considered by many the worst thing imaginable. you could try glPolygonOffset to slide the solid part “into” screen a bit, but this isn’t perfect either.
if you don’t care about the lines being visible through the object you could of course disable the depth test or you could try playing with the stencil buffer to mask the parts that are backfacing…
it’s been a while, but i just did a quick test with a cube and it worked pretty well. you can go 2 routes: push the solid geometry in, or pull the lines out.
This is an indication for depth buffer imprecision.
Make sure your pixelformat has 24 bits of depth.
glGetIntegerv(GL_DEPTH_BITS, &numDepthBits).
If not, change your pixelformat selection code. 24 bits of depth is the max. what today’s hardware offers mainly.
Then check your viewing frustum zNear and zFar settings and make the ratio zFar/zNear as small as possible without clipping your geometry, that is push zNear out and draw zFar in to increase the depth buffer precision.
be careful with the value you use with polygonoffset. the factor and units need to be in proportion to your depth range. the last image suggests to me that your values are out of whack. try something smaller… experiment.
i dunno about the wxWidget stuff. don’t they have a forum or tutorials or documents? the windows setup stuff is tedious but very straightforward, and you need only do it once.
Originally posted by Vincent Dumont: - What do you mean by “depth range”? Are you talking about this: gluPerspective(45, aspectRatio, 0.1, 200); ???
Relic meant that increase the near value AND decrease the far value, so the depth range gets narrower and the depth precision is increased as a result.
==song==