Swapping Pbuffer Buffers via SwapBuffers?

Am I supposed to use SwapBuffers(pbhdc) to swap a pbuffers back buffer to the front? The spec isn’t real clear to me. It works just fine if I manually change the read and write buffer using glReadBuffer or glWriteBuffer but I would rather have it happen automatically via SwapBuffers or some similar command.

Am I supposed to use SwapBuffers(pbhdc) to swap a pbuffers back buffer to the front?
Yes.

I guess I should have mentioned that SwapBuffers doesn’t appear to do anything when I call it. The contents of the back buffer are not swapped to the front and GetLastError is 0. I am using nvidias 61.76 drivers.

What is wierd is that if I use NV_render_texture_rectangle it works fine. It is just the plain old pbuffer that won’t swap the buffers.

Well, I can tell you that it does work when everything is setup properly. I would carefully check my attributes again. Failing that, you might post your Pbuffer setup code, or anything you think is relevant.

iattr[0]: 8237          WGL_DRAW_TO_PBUFFER_ARB
iattr[1]: 1             GL_TRUE
iattr[2]: 8195          WGL_ACCELERATION_ARB
iattr[3]: 8231          WGL_FULL_ACCELERATION_ARB
iattr[4]: 8211          WGL_PIXEL_TYPE_ARB
iattr[5]: 8235          WGL_TYPE_RGBA_ARB
iattr[6]: 8209          WGL_DOUBLE_BUFFER_ARB
iattr[7]: 1             GL_TRUE
iattr[8]: 8226          WGL_DEPTH_BITS_ARB
iattr[9]: 24            24
iattr[10]: 8213         WGL_RED_BITS_ARB
iattr[11]: 8            8
iattr[12]: 8215         WGL_GREEN_BITS_ARB
iattr[13]: 8            8
iattr[14]: 8217         WGL_BLUE_BITS_ARB
iattr[15]: 8            8
iattr[16]: 8219         WGL_ALPHA_BITS_ARB
iattr[17]: 8            8
iattr[18]: 8227         WGL_STENCIL_BITS_ARB
iattr[19]: 0            0
iattr[20]: 8208         WGL_SUPPORT_OPENGL_ARB
iattr[21]: 1            GL_TRUE
iattr[22]: 0

8 suitable pixel formats found
pixel format 8 (index 0): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1
pixel format 16 (index 1): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1
pixel format 64 (index 2): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1
pixel format 72 (index 3): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1
pixel format 10 (index 4): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1
pixel format 18 (index 5): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1
pixel format 66 (index 6): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1
pixel format 74 (index 7): r: 8 g: 8 b: 8 a: 8 depth: 24 multisample: 0 samples: 0 db: 1

Chosen Format: 8

iat[0]: 8306             WGL_TEXTURE_FORMAT_ARB
iat[1]: 8311             WGL_NO_TEXTURE_ARB
iat[2]: 8307             WGL_TEXTURE_TARGET_ARB
iat[3]: 8311             WGL_NO_TEXTURE_ARB
iat[4]: 0
iat[5]: 0

Current DC: 687931992
Current RC: 65536

Created pbuffer 640 x 480
ctt renderer
DoubleBuffered: TRUE

It is strange that I can use the backbuffer and the frontbuffer, it just won’t flip on its own.

Try getting rid of the texture format/target attibutes in the pbuffer attribute list.

It is strange that I can use the backbuffer and the frontbuffer, it just won’t flip on its own.
Forgive me, but the way you worded this suggests you expect the GL to flip the buffers automagically. You still need to call SwapBuffers(). Just so we’re on the same page here :slight_smile:

Getting rid of those two token, which are the default so it really shouldn’t matter, doesn’t change anything. I am considering SwapBuffers to be the automatic way, rather than manually switching which buffer I am reading or writting to so we are on the same page.

I have seen problems in the pixel format attribute list by specifying an unused attribute, and setting it to false. It’s a mystery, but I’ve seen freakier stuff. When I’m in doubt, I’ll try just about anything, just to convince myself it’s not a driver bug.

I don’t see anything wrong with the attribute list you posted, but it’s hard to glean much form that. If it’s a problem with your code, all I can suggest is posting it. If it’s a driver bug, well, then it’s a driver bug.

You might also post your system specs/driver version in case someone has a similar problem with a rig like yours.

Nvidia is usually very solid, I was very surprised that it doesn’t work. If I try to run the same program on my laptop with an ATI card it bails on wglCreatePbufferARB with an error code of 0. That isn’t helpful at all. I am using java so I thought it might be a threading issue, which I have run into before, but that isn’t the case this time. Thanks for the help.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.