Desenhe uma linha reta usando o OpenGL ES no iPhon

or fim, tentei desenhar uma linha usando o OpenGL ES framework no XCode 4.2 para iPhone app game.I simples. Estudei algo sobre GLKView e GLKViewController para desenhar uma linha no iPhone. Aqui está o meu código de exemplo que eu tentei no meu projeto,

@synthesize context = _context;
@synthesize effect = _effect;

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

    if (!self.context) {
        NSLog(@"Failed to create ES context");
    }


    GLKView *view = (GLKView *)self.view;
    view.context = self.context;
    view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
    [EAGLContext setCurrentContext:self.context];

    //[self setupGL];
}

- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
{
    NSLog(@"DrawInRect Method");

    [EAGLContext setCurrentContext:self.context];

    // This method is calling multiple times....

    glClearColor(0.65f, 0.65f, 0.65f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


   const GLfloat line[] = 
   {
        -0.5f, -0.5f, //point A 
        0.5f, -0.5f, //point B  
   };
   glVertexPointer(2, GL_FLOAT, 0, line);
   glEnableClientState(GL_VERTEX_ARRAY);
   glDrawArrays(GL_LINES, 0, 2);
}

Quando executo o projeto, apenas a cor cinza aparece na tela, a linha não aparece. E também o- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect delegado está chamando tempo infinito. Por favor, me guie onde estou fazendo errado. Por que a linha não aparece ou desenha? Você pode por favor ajudar? Estou tentando isso 2 dias. Desde já, obrigado

questionAnswers(2)

yourAnswerToTheQuestion