I would like to know what’s general or most efficint approach to create boundary edges for solids? In some of the books they offer a few techinques like, 4 pass render( stencil, depth buffer test which is hard to implement for me ), another alternative is to use glPolygonOffset.
But what prevents me from using the gl_line or gl_polygon to draw boundary edges if I know the vertex coordinates and indices which comprises the solid and boundaries, doing this way I should surely create another indices collection to maintain the boundary edges which I think is less-cost effective. Am I worong?
Basically instead of messing with that depth, stencil test, drawing the boundaries just with lines, poygons etc…,
My prefered way is: (If it’s possible)
I’ll keep the vertex coordinates, indices(to comprise the solid) and additional indices for boundary representation. After drawing the solid then I’ll draw the boundaries.
Code should be something like this:
method SOLIDOBJECT.OnDraw(RenderingContext )
{
’ 1ST PART
’ call the methods here in order to draw the solids
’ VBO, VBA etc…with provided vertices,normals , textures
'2nd PART
'Draw the boundaries with
Glbegin(gl_Polygon) ’ gl_lines etc…
’ Provide the vertex data and indices here
Any better implementations?
Or what’s nowadays contemporary tecniques for boundaries.
But why that 1st alternative (depth stencil test passes)usually is proposed in many books,it seems like very hard work on CPu or GPU side, clearing color, depth ,stencil buffers are not less memory consuming in my idea?