PhilBot
PhilBot

Reputation: 60

glColorPointer iOS Open GL ES not working?

I am drawing a simple GL_LINE_LOOP on a black background. No matter what I do with the glColorPointer and colors[] array I can't make the lines any other color than white. What am I doing wrong? I'm relatively new to open gl for iPhone and haven't found an answer on Google or here for my problem so I really appreciate any answers.

//glPushMatrix();
glDisable(GL_TEXTURE_2D);
static const GLubyte colors[] = {  
    255,   0,   255, 255,
    255,   0,   255, 255,
    255,   0,   255, 255
};
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState (GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors);
glLineWidth(5.0);
GLfloat vertices[] = { -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0 };
glVertexPointer(3, GL_FLOAT, 0, vertices);
glDrawArrays(GL_LINE_LOOP, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glEnable(GL_TEXTURE_2D);
glPopMatrix();

Upvotes: 0

Views: 939

Answers (1)

Skyler Saleh
Skyler Saleh

Reputation: 3991

Try disabling texturing...

glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,0);

Upvotes: 1

Related Questions