title: Creating OpenGL context without window
body: <p>I'm trying to figure out what is the simplest way to create a windowless OpenGL program for offscreen rendering.</p>
  
  <p>Currently I use this, and it works fine so far: (error checks removed here for clarity)</p>
  
  <pre><code>BOOL create_opengl_context(){
      GLuint PixelFormat;
      static PIXELFORMATDESCRIPTOR pfd;
      hDC = GetDC(NULL);
      PixelFormat = ChoosePixelFormat(hDC, &amp;pfd);
      SetPixelFormat(hDC, PixelFormat, &amp;pfd);
      hRC = wglCreateContext(hDC);
      wglMakeCurrent(hDC, hRC);
  }
  </code></pre>
  
  <p>Is this safe to use? What is the "standard" way to create a windowless OpenGL program?</p>
  
  <p><strong>Edit:</strong> I'm using FBO for the offscreen rendering.</p>