@badawe So you want to cut a hole in your texture? And the poly is closed (ccDrawPoly(..., YES), right?
You can do this in a lot of different ways: blending, alphatest, stencil, ... Important is, all methods leave the original texture untouched, so you need to save all polys the user has drawn and always draw them as a "hole" one after each other. Or always render to a CCRenderTexture and use the result as new texture for your CCNode (I would prefer to always draw, not to use rendertexture).
If I understand correctly your code just draws the outline of the polygon, because ccDrawPoly uses -in your case closed=YES- GL_LINE_LOOP, but you need a filled poly.
Ok, for that you really need to triangulate the poly. The process is like that:
- at first draw your background texture
- triangulate your poly with the triangulator above, BUT use the C++ source directly!
there is an example above or look into the source of PRKit, initWithPoints
- NOW you need color for each vertice
ccColor4F *colors = malloc(sizeof(ccColor4F) * numberOfTriangleVertices);
for (int i=0; i<numberOfTriangleVertices; i++) {
colors[i] = (ccColor4F){1.f, 0.f, 1.f, 1.f};
}
- disable GL_TEXTURE_2D (you only want colors)
- set glVertexPointer
- set glColorPointer
- draw
- enable GL_TEXTURE_2D to restore the default states



