PDA

View Full Version : PBuffer performance / WGL_ACCELERATION_ARB



demonoid
06-02-2004, 01:53 AM
hi everyone,

shouldn't it be much faster to render to a pbuffer and then bind it to a texture object, instead of rendering to the framebuffer and use glCopyTexImage2D(...)? thats why pbuffers were introduced, right?

well, in my case pbuffers are twice as slow. i suppose it's because i cant get a hardware-accelerated pixelformat: if i add {WGL_ACCELERATION_ARB, true}, wglChoosePixelFormatARB() return 0 PFs.
can this be because of my gpu (geforeFX 5200) or did i miss sth? here are the PF attributes i need:

iattribs[n++]=WGL_ACCELERATION_ARB;
iattribs[n++]=true;
iattribs[n++]=WGL_SUPPORT_OPENGL_ARB;
iattribs[n++]=true;
iattribs[n++]=WGL_DRAW_TO_PBUFFER_ARB;
iattribs[n++]=true;
iattribs[n++]=WGL_BIND_TO_TEXTURE_RGBA_ARB;
iattribs[n++]=true;

iattribs[n++]=WGL_DOUBLE_BUFFER_ARB;
iattribs[n++]=false;
iattribs[n++]=WGL_RED_BITS_ARB;
iattribs[n++]=8;
iattribs[n++]=WGL_BLUE_BITS_ARB;
iattribs[n++]=8;
iattribs[n++]=WGL_GREEN_BITS_ARB; iattribs[n++]=8;
iattribs[n++]=WGL_ALPHA_BITS_ARB; iattribs[n++]=8;
iattribs[n++]=WGL_DEPTH_BITS_ARB; iattribs[n++]=0;
iattribs[n++]=0;

thanks for the help,
demonoid

ZbuffeR
06-02-2004, 08:37 AM
Here are the attributes I used with great success :

const int hdcAttributes [30]={
WGL_SUPPORT_OPENGL_ARB, TRUE, // pbuffer will be used with gl
WGL_BIND_TO_TEXTURE_RGB_ARB ,TRUE,
WGL_DRAW_TO_PBUFFER_ARB ,TRUE,
WGL_COLOR_BITS_ARB , 24,
WGL_DEPTH_BITS_ARB ,24,
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
0 };Mostly noticable is that you request a double buffer for your pbuffer, whereas obviously it is not useful.

You can have a look at my webpage with my different experiments with pbuffers and copytexsubimage (source code included) :
http://www.chez.com/dedebuffer/

Hope it helps.

jwatte
06-02-2004, 01:14 PM
Pbuffers were introduced to allow offscreen rendering that's legal and valid even when a possible window context might be obscured by other windows. A later extension adds the ability to texture out of pbuffers.

That being said, depending on the hardware and the driver versions involved, it might be faster to CopyTexSubImage() into a texture, because the hardware may use less efficient (non-swizzling) texture read modes when texturing out of a pbuffer. So implement it both ways and measure, to be sure.

demonoid
06-02-2004, 11:23 PM
{WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB}instead of {WGL_ACCELERATION_ARB, true} did it.

strange enough: things get even slower this way (?!)

thanks a lot,
demonoid

equentric
06-03-2004, 04:45 AM
I'm actually using a geforce4 ti 4600, and I don't see any difference with or without "WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB". speed remains the same.

Moeover using RGBA and depthtexture from one single pbuffer does not slow the pbuffer neither