title: Intel HD Graphics: Shader link error: "Out of resource error." because of gl_ClipVertex
body: <p>I just found that the following minimum OpenGL GLSL Vertex Shader fails to link on <strong>Intel HD Graphics</strong> cards with the GLSL link error <strong>"Out of resource error."</strong> as soon as the Vertex Shader source code contains the line <code>gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;</code>. The same Shader compiles and links fine on NVIDIA or ATI graphics cards.</p>
  
  <p>Does anyone know what might causing the link error on <strong>Intel HD Graphics</strong> cards? </p>
  
  <p>Python script:
  </p>
  
  <pre><code>from OpenGL.GLUT import *         
  from OpenGL.GL   import *       
  from OpenGL.GL   import shaders 
  
  VERTEX_SHADER_SOURCE = """
  #version 110
  
  void main(void)
  {
    gl_Position = ftransform();
    gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex; // Comment this line to link on Intel HD Graphics
    gl_FrontColor = vec4(1.0);
  }"""
  
  def main():
      glutInit(sys.argv)
      glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH)
      glutInitWindowSize(800,600)
      glutCreateWindow('IntelHDGraphicsClipPlanes')
      glutDisplayFunc(render)
  
      glEnable(GL_CLIP_PLANE0)
  
      VERTEX_SHADER = shaders.compileShader(VERTEX_SHADER_SOURCE, GL_VERTEX_SHADER)
      shader = shaders.compileProgram(VERTEX_SHADER)
  
      shaders.glUseProgram(shader)
      glutMainLoop()
      return
  
  def render():
      glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
  
      glutSwapBuffers()
      return
  
  if __name__ == '__main__': main()
  </code></pre>
  
  <p>Python script output:
  <a href="https://i.stack.imgur.com/oC1fu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oC1fu.png" alt="Python script output"></a></p>
  
  <p>Platform:
  I am experiencing this behavior on various platforms with Intel HD Graphics cards but I am primarily testing this on a Microsoft Surface tablet with Windows 10 and Intel HD graphics 4400.</p>