we know that at present the clutter's clipping is implemented in clip plane/stencil buffer/Scissor.
using stencil buffer, we
can implement arbitrarily ploygonous clipping. it is one very common way
to do the clipping in gles.
but now ,we have a new demand to implement the clipping without stencil buffer . because in our target the clipping based on stencil buffer is very slow, unacceptable.
we consider two ways. i hope other guys can give me some suggestion or new idear.
1. if only rect clipping is considered,can i clip the actor in fragment shader?
the clip arear is in object coordinates, can i in fragment shader , convert the fragment coord point from clip coordinates to object coordiantes ,then using rect including algorthim to discard those not in the area?
vec4 obj = inverse_mvp*gl_FragCoord to compute the fragment's object coordiate , then to discard those not in the clip area
can it be possible?
2. if the arbitrarily ploygonous clipping is required, can texture-based clipping be one good option?
i may use one offscreen texture to render the clipping area, then in the later fragment shader, to discard those outise of the cliping texture .
it is just my idear, i still don't know how to implement it in the shaders.
except the aboves, can i have other way to do the clipping ?can someone give me good idear or comment some detail info on how to implement ?
i also see some clipping using depth buffer test, this is also not one good way in our target, in our target ,the depth test is also slow.
thanks.
