title: IOS OpenGL gpus_ReturnGuiltyForHardwareRestart Error
body: <p>I am having major issues a with a  libGPUSupportMercury.dylib gpus_ReturnGuiltyForHardwareRestart error.</p>
  
  <p>Currently I am rendering a cube and a line. If I render just the cube or just the line the error arises about 20% of the time. If i render both i get the error about 90% of the time. </p>
  
  <p>I have read online that this is a bug in ios and there is nothing that can be done. However, other OpenGL programs like unity do not have this issue. So I must be doing something wrong</p>
  
  <p>The following is a simplified version of the code i am using. </p>
  
  <pre><code>-(void) setUp{
      m_context = [[[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2] autorelease];
      [EAGLContext setCurrentContext:m_context];
  
      glGenRenderbuffers(1, &amp;m_renderbuffer);
      glBindRenderbuffer(GL_RENDERBUFFER, m_renderbuffer);
      [m_context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer*)self.layer];
  
      glGenFramebuffers(1, &amp;m_framebuffer);
      glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
      glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,    m_renderbuffer);
  }
  
  
  
  -(void) render{
      //[EAGLContext setCurrentContext:m_context];  Error seems to happen more frequent if I uncomment these lines
      // glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer);
  
      glViewport(0, 0, self.bounds.size.width, self.bounds.size.height);
  
      glClearColor(0.3, 0.3, 0.3, 1);
      glClear(GL_COLOR_BUFFER_BIT);
  
      [self renderCube];  // VBO
      [self renderLine];  // NON VBO
  
      [m_context presentRenderbuffer:GL_RENDERBUFFER]; &lt;---- Error Here
  }
  
  
  
  -(void) renderCube
  {
       glUseProgram(m_cubeProgram);
  
       glBindTexture(GL_TEXTURE_2D, m_textureHandle);
  
       glUniformMatrix4fv(m_uniformHandles[UNIFORM_PROJECTION_MATRIX], 1, GL_FALSE, m_projectionMatrix.m);
       glUniformMatrix4fv(m_uniformHandles[UNIFORM_MODELVIEW_MATRIX], 1, GL_FALSE, m_modelMatrix.m);
  
       glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_cubeIndexVBO);
  
       glEnableVertexAttribArray(m_attributeHandles[ATTRIB_POSITION]);
       glEnableVertexAttribArray(m_attributeHandles[ATTRIB_TEXCOORD]);
  
       glBindBuffer(GL_ARRAY_BUFFER, m_cubeVertexVBO);
       glVertexAttribPointer(m_attributeHandles[ATTRIB_POSITION], 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
       glVertexAttribPointer(m_attributeHandles[ATTRIB_TEXCOORD], 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*) (sizeof(float) * 3));
  
       glDrawElements( GL_TRIANGLES, m_numberOfIndices, GL_UNSIGNED_SHORT, (void*)0              );
  
       glDisableVertexAttribArray(m_attributeHandles[ATTRIB_POSITION]);
       glDisableVertexAttribArray(m_attributeHandles[ATTRIB_TEXCOORD]);
  
      glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);  // Desperate attempt to fix the issue
      glBindBuffer(GL_ARRAY_BUFFER, 0);          // this too
      glBindTexture(GL_TEXTURE_2D, 0);           /// this too
  }
  
  
  
  
  
  -(void) renderLine
  {
      glUseProgram(m_lineProgram);
  
      glUniformMatrix4fv(m_uniformHandles[UNIFORM_LINE_PROJECTION_MATRIX], 1, GL_FALSE, m_projectionMatrix.m);
      glUniformMatrix4fv(m_uniformHandles[UNIFORM_LINE_MODELVIEW_MATRIX], 1, GL_FALSE, m_modelView.m);
  
      glEnableVertexAttribArray(m_attributeHandles[ATTRIB_LINE_POSITION]);
  
      float linVertices[]= {...};
  
      glVertexAttribPointer(m_attributeHandles[ATTRIB_LINE_POSITION], 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, lineVertices);
  
      glLineWidth(3.0f);
      glDrawArrays(GL_LINE_STRIP, 0, 3);
  
      glDisableVertexAttribArray(m_attributeHandles[ATTRIB_LINE_POSITION]);
  }
  </code></pre>