Multiple PBuffers

I am trying to use multiple PBuffers (in WinXP), but they seem to interfere with each other.

  1. Do I have to supply a different HDC for wglCreatePbufferARB() each time I create another PBuffer?
  2. Why do I have to supply an HDC at all? I mean, PBuffers are meant for off-screen rendering in the first place.
  3. If I need multiple PBuffers and I must give a different HDC each time, is there a way to create those HDCs without constructing multiple dummy windows?


i never used pbuffers. but their main disadvantage is, that they need context and context switch when you want to render to them. i waited for FBO, look at that, its easy and portable :slight_smile:

For one PBuffer, you need one HPBUFFERARB, one HDC and one HGLRC.

Create the HPBUFFERARB from wglCreatePbufferARB.
Pass the HPBUFFERARB to wglGetPbufferDCARB and it gives you the HDC.
Pass the HDC to wglCreateContext and it gives you the HGLRC

You can use wglShareLists to share the display lists and textures with the main HGLRC, although when switching context, you need to reset the OpenGL states (all your glEnable and other).

Switch to your PBuffer with wglMakeCurrent.