title: What is the PIXELFORMATDESCRIPTOR parameter in SetPixelFormat() used for?
body: <p>Usually when setting up OpenGL contexts, I've simply filled out a PIXELFORMATDESCRIPTOR structure with the necessary information and called ChoosePixelFormat(), followed by a call to SetPixelFormat() with the returned matching pixelformat from ChoosePixelFormat(). Then I've simply passed the initial descriptor without giving much thought of why.</p>
  
  <p>But now I use wglChoosePixelFormatARB() instead of ChoosePixelFormat(), because I need some extended traits like sRGB and multisampling. It takes an attribute list of integers, just like  XLib/GLX on Linux, not a PIXELFORMATDESCRIPTOR structure. So, do I really have to fill in a descriptor for SetPixelFormat() to use? What does SetPixelFormat() use the descriptor for when it already has the pixelformat descriptor index? Why do I have to specify the same pixelformat attributes in two different places? And which one takes precedence; the attribute list to wglChoosePixelFormatARB(), or the PIXELFORMATDESCRIPTOR attributes passed to SetPixelFormat()?</p>
  
  <p>Here are the function prototypes, to make the question more clear:</p>
  
  <pre><code>/* Finds a best match based on a PIXELFORMATDESCRIPTOR,
  and returns the pixelformat index */
  int ChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd);
  
  /* Finds a best match based on an attribute list of integers and floats,
  and returns a list of indices of matches, with the best matches at the head.
  Also supports extended pixelformat traits like sRGB color space,
  floating-point framebuffers and multisampling. */
  BOOL wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList,
      const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats,
      UINT *nNumFormats
  );
  
  /* Sets the pixelformat based on the pixelformat index */
  BOOL SetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd);
  </code></pre>
  
  <p>EDIT: <a href="http://msdn.microsoft.com/en-us/library/dd369049(VS.85).aspx" rel="noreferrer">MSDN</a> says this about the SetPixelFormat() parameter:</p>
  
  <blockquote>
    <p>Pointer to a PIXELFORMATDESCRIPTOR structure that contains the logical pixel format specification. The system's metafile component uses this structure to record the logical pixel format specification. The structure has no other effect upon the behavior of the SetPixelFormat function.</p>
  </blockquote>
  
  <p>But I have no idea what this means, or how it relates to my question(s).</p>