PDA

View Full Version : Boudary Edges



Tanji
02-06-2011, 03:58 AM
Hi all,

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?

Any comment will be appreciated!

_arts_
02-06-2011, 05:11 AM
I didn't spotted your second part. Can you explain it more ?

For doing what you want (at least from your first part), I'd do something like this:

1st pass: render normally
2nt pass: choose to render lines instead of plain solid (glPolygonMode), clear depth buffer only, and render again.

Tanji
02-06-2011, 05:39 AM
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

glEnd(glPolygon)

}

_arts_
02-06-2011, 06:23 AM
Yes that should work. Ensure your depth test to be GL_LEQUAL for the second pass so that your boundary won't be rejected.

Tanji
02-06-2011, 06:36 AM
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?

Thanks in advance,

_arts_
02-06-2011, 07:39 AM
I think depth-stencil several passes will never fail to work, even with transparencies and will have no artefacts, that simple methods could show.

Maybe other people, more leveled than me could help you here.