PDA

View Full Version : Rendering High Order Bezier Patches



GingerBread
03-26-2012, 08:26 AM
Hey,
What would be the best way to render a high order bezier patch? As there is a limit on number of control points per patch, do we need to segment the whole bezier patch?

Thanks and Regards,

malexander
03-26-2012, 10:40 AM
If you're using a GL4 tessellation shader to render the patch, then there is a limit to the number of points in the patch. I believe it's 32 vertices, but check GL_MAX_PATCH_VERTICES.

GingerBread
03-26-2012, 11:16 AM
Yes, I know that. We only can have 32 vertices in a patch. But what if I have more than 32 vertices, is there any approach to render the bezier surface still as if it looks like the whole original patch rendered at once?

malexander
03-26-2012, 12:01 PM
Sorry, read "As" as "Is". More caffeine required on Monday mornings.

You can send the large patch as several subpatches, each 4x4 (assuming a bezier of order 4). With an element buffer to do the vertex indexing, you can just send the points of the large surface once, wire up all the subpatches in the element buffer, and send the whole surface in one glDrawElements() call.

GingerBread
03-26-2012, 01:02 PM
Yeah it's required. :)

I think in element buffer, I can do indexing for a currently bind buffer. And does this GL_MAX_PATCH_VERTICES limit not apply on the count parameter of glDrawElements() or not?


glPatchParameteri(GL_PATCH_VERTICES, 16);
glDrawElements(GL_PATCHES, 16, GL_UNSIGNED_INT, 0);

Can you be please more explicit? It's still not clear to me.

GingerBread
03-27-2012, 05:39 AM
The approach I got is just to send your all data with Texture Buffers and it works perfectly fine. For each surface you just need to send a quad (4 control points patch).