Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a texture and vertex which are needed to create a set of closed polygons. For this purpose I use these functions:

Code for create texture:

CCSprite* spr = CCSprite::spriteWithTexture(mShape->getTexture());

spr->setPosition(ccp(spr->getTextureRect().size.width/2, spr->getTextureRect().size.height/2));

CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(mShape->getTextureRect().size.width, mShape->getTextureRect().size.height);

texture->beginWithClear(1, 1, 1, 0);

glColor4f(0, 0, 0, 1);

for(int i=0; i < innerBorders.size(); i++) {
    std::vector<Vector2d> sitePoints =;

    for(int n=1; n < sitePoints.size(); n++ ) {
        Vector2d origin =;
        Vector2d destination =;

        drawSmoothLine(ccp(origin.GetX(), origin.GetY()), ccp(destination.GetX(), destination.GetY()), 0.25f);

glColor4f(1.0, 1.0, 1.0, 1.0);


drawSmoothLine method:

drawSmoothLine(CCPoint pos1, CCPoint pos2, float width){
GLfloat lineVertices[12], curc[4];
GLint   ir, ig, ib, ia;
CCPoint dir, tan;

width = width*8;
dir.x = pos2.x - pos1.x;
dir.y = pos2.y - pos1.y;
float len = sqrtf(dir.x*dir.x+dir.y*dir.y);
dir.x = dir.x/len;
dir.y = dir.y/len;
tan.x = -width*dir.y;
tan.y = width*dir.x;

lineVertices[0] = pos1.x + tan.x;
lineVertices[1] = pos1.y + tan.y;
lineVertices[2] = pos2.x + tan.x;
lineVertices[3] = pos2.y + tan.y;
lineVertices[4] = pos1.x;
lineVertices[5] = pos1.y;
lineVertices[6] = pos2.x;
lineVertices[7] = pos2.y;
lineVertices[8] = pos1.x - tan.x;
lineVertices[9] = pos1.y - tan.y;
lineVertices[10] = pos2.x - tan.x;
lineVertices[11] = pos2.y - tan.y;

ir = 255.0*curc[0];
ig = 255.0*curc[1];
ib = 255.0*curc[2];
ia = 255.0*curc[3];

const GLubyte lineColors[] = {
    ir, ig, ib, 0,
    ir, ig, ib, 0,
    ir, ig, ib, ia,
    ir, ig, ib, ia,
    ir, ig, ib, 0,
    ir, ig, ib, 0,

glVertexPointer(2, GL_FLOAT, 0, lineVertices);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, lineColors);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 6);

I need to get the texture of the contour (without the main texture on the background.) How can it be done using openGL ES 1.1?

share|improve this question

closed as unclear what you're asking by Jimmy, Seth Battin, Sean Middleditch, Josh Petrie Jan 2 '14 at 22:48

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

What kind of contour are you talking about? Provide some pictures please. – akaltar Dec 25 '13 at 13:37
As @akaltar asked, can you give an example image? What do you mean by "get the texture of the contour"? What have you tried already, and what's not working about it? – Seth Battin Dec 28 '13 at 4:44