View Full Version : drawing a grid on top of a surface (polygon)
I have a floor on top of which I draw a grid - if I rotate the scene part of the grid starts to disappear because it is literally draw above it, on the surface - is there a way of preventing the grid from dispearing when I do something like rotate?
03-23-2001, 08:32 AM
Do a search on PolygonOffset in the forum.
You want to offset the plane back in z a bit so that it doesn't obscure the lines. POLYGON_OFFSET_LINES is not working here!
But I don't recommend to use polygon offset on mixed graphics. It's only meant for polygonal primitives and better be used with glPolygonMode.
Draw the lines first with stencil buffering and do NOT draw the plane where the lines have set the stencil value to something.
03-23-2001, 09:47 AM
set the depthfunc to GL_ALWAYS but this would obviously draw it on everything but it depends on what you want it for. Draw the floor and then the grid and then everything else should work better with the above.
what should I set the offset parameters to?
03-30-2001, 02:47 AM
Depends on your glDepthRange and depth comparison.
You should be able to figure that out from the glPolygonOffset documantation.
For default depth settings try glPolygonOffset(0.0, 1.0) and glPolygonOffset(1.0, 1.0). Effectiveness is implemtnation dependent, increase values if you still see cracks.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.