title: OpenGL ES 2.0 GLKit Draw a line
body: <p>I am trying to draw a line with OpenGL ES 2.0 GLKit.  When I run the following code and use OpenGL ES Analyzer I get the following errors:</p>
  
  <p>"Use of Non-Existent Program"
  glDrawArrays(GL_LINE_STRIP,0,4)</p>
  
  <p>"GL Error: Invalid Operation"
  GL_INVALID_OPERATION &lt;- glVertexPointer(2,GL_FLOAT,0,NULL)
  GL_INVALID_OPERATION &lt;- glEnableClientState(GL_VERTEX_ARRAY)</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#import "GLDrawingView.h"
  
  
  const float data[] = {0.0f, 1.0f, 0.0f, 0.0f, 1.0f, -0.0f, 0.0f, 1.0f};
  
  
  
  @interface GLDrawingView () {
      GLuint lineVBO;
  }
  
  @end
  
  @implementation GLDrawingView
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          [EAGLContext setCurrentContext:self.context];           
          glGenBuffers(1, &amp;lineVBO);
          glBindBuffer(GL_ARRAY_BUFFER, lineVBO);
          glBufferData(GL_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW);
      }
      return self;
  }
  
  - (void)drawRect:(CGRect)rect
  {
      glVertexPointer(2, GL_FLOAT, 0, NULL);   
      glEnableClientState(GL_VERTEX_ARRAY);
      glDrawArrays(GL_LINE_STRIP, 0, sizeof(data) / sizeof(float) / 2);
  }
  
  @end
  </code></pre>