I am trying to draw some lines in my GLView, but it just doesn't do anything.
I'm using Xcode 4.5 for iOS 6.0 application.
This is my code:
//Draw Axes
{
const GLfloat lineX[] = {
-100.0f, 0.0f, 0.0f, //point A
100.0f, 0.0f, 0.0f //point B
};
const GLfloat lineY[] = {
0.0f, -100.0f, 0.0f, //point A
0.0f, 100.0f, 0.0f //point B
};
const GLfloat lineZ[] = {
0.0f, 0.0f, -100.0f, //point A
0.0f, 0.0f, 100.0f //point B
};
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f(1.0f, 0.0f, 0.0f, 1.0f); // opaque red
glVertexPointer(3, GL_FLOAT, 0, lineX);
glDrawArrays(GL_LINES, 0, 2);
glColor4f(0.0f, 1.0f, 0.0f, 1.0f); // opaque green
glVertexPointer(3, GL_FLOAT, 0, lineY);
glDrawArrays(GL_LINES, 0, 2);
glColor4f(0.0f, 0.0f, 1.0f, 1.0f); // opaque blue
glVertexPointer(3, GL_FLOAT, 0, lineZ);
glDrawArrays(GL_LINES, 0, 2);
glDisableClientState(GL_VERTEX_ARRAY);
}
I'm new to openGL and I'm just trying to do some basic stuff. I can use glClear:
glClearColor(1, 0, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
so it seems that the context is right but I can't draw the lines.
any help... Thank you.