PDA

View Full Version : how to use multi-surface of pbuffer



foollove
02-25-2004, 07:48 PM
As we know changing pbuffers is slow, changing surfaces is fast. But I don't how to make it work.
(Here I have set the Wgl_Double_Buffer in pbuffer pixel format)
pbuffer->MakeCurrent();
///Front surface
glDrawBuffer(WGL_FRONT_LEFT_ARB);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex0_id);
wglReleaseTexImageARB(hpf, WGL_FRONT_LEFT_ARB);
glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, ShaderID);

DrawSomething;

glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex0_id);
wglBindTexImageARB(hpf, WGL_FRONT_LEFT_ARB);

///Back
glDrawBuffer(WGL_BACK_LEFT_ARB);
wglReleaseTexImageARB(hpf, WGL_BACK_LEFT_ARB);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex1_id);
wglReleaseTexImageARB(hpf, WGL_BACK_LEFT_ARB);
glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, ShaderID);

DrawSomething;

glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex1_id);
wglBindTexImageARB(hpf, WGL_BACK_LEFT_ARB);

Thank you in advance.

Zengar
02-26-2004, 07:35 AM
That sounds like I problem I've got recently. I was trying to do gaussian blur. Everything is fine, but I need to blur the texture several times - and copying to a texture is soooo slow! I get 30 fps using a 64x64 rgba texture with 5 renderpasses. I thought, render to texture may solve it, but I have to switch pbuffers all the time, so I result in lower performance.
Isn't there a way of rendering to the same texture several times?

I_dont_know
02-26-2004, 10:59 AM
I have another question on the pbuffer. Is there a way (as fast as SwapBuffers()) to render pbuffer to the main window with alpha blending (after or before I draw a main scene)?