Question

How can I render a plane on the surface of a glClipPlane clipping plane? The plane is rendered by drawing a polygon between a series of points that are located on the plane. Right now, it's producing some very fun stitching.

I assume glPolygonOffset won't help me here?

It is possible for me to just translate the plane a tiny bit over to one side of the plane, but I would prefer a simpler and more elegant solution, if one exists.

Was it helpful?

Solution

I assume you are not using GLSL? If you have GLSL 1.30, you can just set a vertex's gl_ClipDistance [N] >= 0.0 for clip plane N and the point will not be clipped. If you do that for every vertex in the polygon you want to span your plane, the polygon will not be clipped (against that plane anyway).

As for glPolygonOffset (...) that affects the depth computed during rasterization. It happens after clipping, and likewise clipping has nothing to do with polygon depth, so you are correct it will not help. You will have to translate your vertices before/during primitive assembly for this to work, so that either means performing translation in a vertex shader or using the fixed-function modelview matrix.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top