filling texture in a custom node

Hi,
I have a customized CCNode named `Shape` and overridden `draw` function as follows:

CCGLProgram s_pShader = CCShaderCache::sharedShaderCache~~>programForKey;
int s_nColorLocation = glGetUniformLocation, “u_color”);
CCPoint origin = ccp;
CCPoint destination = ccp;
CCPoint vertices;
ccColor4F color = ccc4f;
int numberOfPoints = 10;
vertices = calloc
numberOfPoints, 1);
vertices[0] = origin;
for {
vertices[i].x = origin.x + 100
cos;
vertices[i].y = origin.y + 100** sin;
}
s_pShader~~>use;
s_pShader~~>setUniformForModelViewProjectionMatrix;
s_pShader~~>setUniformLocationWith4fv &color.r, 1);
ccGLEnableVertexAttribs;
ccVertex2F** newPoli = new ccVertex2F[numberOfPoints];
if( sizeof(CCPoint) == sizeof(ccVertex2F) ) {
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, vertices);
} else {
for( unsigned int i=0; i<numberOfPoints;i++) {
newPoli[i] = vertex2( vertices[i].x, vertices[i].y );
}
glVertexAttribPointer(kCCVertexAttrib_Position, 2, GL_FLOAT, GL_FALSE, 0, newPoli);
}
glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) numberOfPoints);

Its a ditto of ccDrawPoly function. Now I would like to apply some texture to the drawn shape instead of the plain solid color. Please give me tips on how to do this.

Thanks :slight_smile: