I want to clip some closed path area from texture image in OpenGL ES and iPhone SDK.
I found that it can be done with planes and glClipPlanef function something like this:
glClipPlanef(GL_CLIP_PLANE0, v);
glEnable(GL_CLIP_PLANE0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisable(GL_CLIP_PLANE0);
where v is a const GLfloat array of coordinates.
I can not figure out how to set these coords to clip the closed path area?
I understand how to use glClipPlanef:
where A, B, C, D – parameters of plane equation.
If we have three points with coords (x1,y1,z1), (x2,y2,z2), (x3,y3,z3) then
If you have 2D texture you’ll need to define points as follows: (x1, y1, 0), (x2, y2, 0 and (x3, y3, 1). This will work.
Hope this will help somebody in future.