


New Paste :: Recent Pastes:: Add Line Numbers

pbuffer by DELTRON
// I assume the following:
// You have requested the pixel format attribs that you require for your pbuffer and
// have received a pixel format that matches the criteria you specified.
// Now it is time to create the pbuffer in your code.

HPBUFFERARB pbhandle = 0;

   pbhandle = wglCreatePbufferARB(hdc, format, iwidth, iheight, iattribs);

   if (!pbhandle)
       // buffer was not created.
       // at this point you would request a smaller buffer until one was found or whatever.

// if the pbuffer was successfully created, you can query information about it

   wglQueryPbufferARB(pbhandle, WGL_PBUFFER_WIDTH_ARB, &width);
   wglQueryPbufferARB(pbhandle, WGL_PBUFFER_HEIGHT_ARB, &height);

// WGL_PBUFFER_LOST_ARB can be used to query if the pbuffer memory was lost.
// This can happen if you have a display mode change in your program.
// If this is happening you need to destroy and recreate your pbuffer.