PBuffer slow after deleting and creating

I’ve got a performance problem with PBuffers.
In my program I want to be able to turn HDR on and off, so I need to create and delete PBuffers many times.
When I create two PBuffers it’s ok - I can render to them and I got a lot FPS. But when I create third PBuffer (with or without deleting the other two) I got terrible performance. After that there is no way of creating new, fast PBuffer - all next PBuffers (even when I delete all PBuffers) runs slow.
I create them with 8 stencil bits, but I don’t use stencil at all in the rendering.

Do you know what can I do?
Or maybe it’s a “known” problem and, let say, FBO resolves it?

Thanks for your help.

I don’t know pbuffers, I only used FBO. But why use stencil if you don’t need them ? Anyway, this won’t be a solution to your problem. Also, if you can do 2 pbuffers without bottlneck at all, why don’t use swap them ??

also, pbuffers are quiete old now, it might be best to use FBO even if that might not solve your problems.

Yea, use FBO, they are made as an replacement for p-buffers, not a supplement or a addition.
The problem with p-buffers are that they are infact separate child rendercontexts, it’s like having several openGL programs running at the same time, and this causes a whole array of problems, ranging from knowing wich PFD is supported to various texture problems.

FBOs on the other hand is made so that you can swap out the color buffer or the depth buffer anyway you like, and as color buffers (or any other buffer for that matter) you could use any texture you like as long as it’s the same size as the rest and not currently bound with glBind.
Give it a try, i know for a fact that once you get them running you will never go back to P-buffers.

This isnt restricted to pbuffers.

I use FBOs and have optional HDR like yourself.

Whichever buffer is created second suffers a performance hit. I have only tested this on nVidia cards and am not sure whether it is a memory alignment issue or just some random optimisation for the first created buffer.

I would be interested to know whether anyone else has noticed this, or if it is documented anywhere.

Can you develop your second pbuffer/FBO issues ? I never tried that but that sounds important.