title: How to initialize OpenGL context with PyGame instead of GLUT
body: <p>I'm trying to start with OpenGL, using Python and PyGame.</p>
  
  <p>I'm going to use PyGame instead of GLUT to do all the initializing, windows opening, input handling, etc.</p>
  
  <p>However, my shaders are failing to compile, unless I specify exactly the version of OpenGL and profile. </p>
  
  <p>They <em>do</em> compile with GLUT initialization from the book:</p>
  
  <pre><code>glutInit()
  glutInitDisplayMode(GLUT_RGBA)
  glutInitWindowSize(400, 400)
  
  # this is what I need
  glutInitContextVersion(3, 3)
  glutInitContextProfile(GLUT_CORE_PROFILE)
  
  glutCreateWindow("main")
  </code></pre>
  
  <p>But, with simple PyGame initialization like this:</p>
  
  <pre><code>pygame.init()
  display = (400, 400)
  pygame.display.set_mode(display, pygame.DOUBLEBUF|pygame.OPENGL)
  </code></pre>
  
  <p>which doesn't specify exact OpenGL version 3.3 and CORE_PROFILE,
  the same program would fail when trying to compile shaders:</p>
  
  <blockquote>
    <p>RuntimeError: ('Shader compile failure (0): 0:2(10): error: GLSL 3.30
    is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES,
    and 3.00 ES\n', ['\n    #version 330 core\n    layout(location = 0) in
    vec4 position;\n    void main()\n    {\n        gl_Position =
    position;\n    }\n    '], GL_VERTEX_SHADER)</p>
  </blockquote>
  
  <p>My question is: how do I do this initialization with PyGame?</p>