views:

32

answers:

0

I have tried as follows (got through Google search)-

static const GLfloat vertices[] = 
{
    0.0, 0.0,
    250.0, 280.0,           
    250.0, 280.0,
    250.0, 500.0,
    250.0, 500.0,
    350.0, 500.0,
    350.0, 500.0,
    250.0, 280.0
};

static const GLubyte squareColors[] = {
    255, 255, 255, 255,
    255, 255, 255, 255
};

glDisable(GL_TEXTURE_2D);
BOOL colorArrayEnabled = glIsEnabled(GL_COLOR_ARRAY);
if (!colorArrayEnabled) {
    glEnableClientState(GL_COLOR_ARRAY);
}

BOOL vertexArrayEnabled = glIsEnabled(GL_VERTEX_ARRAY);
if (!vertexArrayEnabled) {
    glEnableClientState(GL_VERTEX_ARRAY);
}

glLineWidth(16.0f);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
glVertexPointer(2, GL_FLOAT, sizeof(GLfloat)*2, vertices);
glDrawArrays(GL_LINES, 0, 2);


if (!vertexArrayEnabled) {
    glDisableClientState(GL_VERTEX_ARRAY);
}

if (!colorArrayEnabled) {
    glDisableClientState(GL_COLOR_ARRAY);
}
glEnable(GL_TEXTURE_2D);

FYI: I am a starter in iPhone programming.