PDA

View Full Version : pBuffer's stencil buffer support



him_me2
12-10-2009, 11:27 PM
Hi All,

I'm using the pBuffer (WGL_ARB_pbuffer) for rendering offscreen.
I'm trying to get the stecil buffer for the pbuffer but i'm not getting allocated stencil buffer bits.

i'm also setting the stencil buffer bits in the PIXELFORMATDESCRIPTOR but there i'm getting the valid pixel format.
The attribute list is shown here


int pf_attr[] =
{
WGL_SUPPORT_OPENGL_ARB, TRUE, // P-buffer will be used with OpenGL
WGL_DRAW_TO_PBUFFER_ARB, TRUE, // Enable render to p-buffer
WGL_RED_BITS_ARB, 8, // At least 8 bits for RED channel
WGL_GREEN_BITS_ARB, 8, // At least 8 bits for GREEN channel
WGL_BLUE_BITS_ARB, 8, // At least 8 bits for BLUE channel
WGL_ALPHA_BITS_ARB, 8, // At least 8 bits for ALPHA channel
WGL_DEPTH_BITS_ARB, 0, // At least 16 bits for depth buffer
WGL_STENCIL_BITS_ARB, 0,
WGL_FULL_ACCELERATION_ARB, 1,

WGL_DOUBLE_BUFFER_ARB, FALSE, // We don't require double buffering
0 // Zero terminates the list
};

And my second doubt is that my card doesn't show support for pBuffer Extension, but still i'm getting access to the pBuffer for rendering. Is i'm getting the software support only??

I also tried setting the Flags in attribute list as WGL_GENERIC_ACCELERATION_ARB and WGL_NO_ACCELERATION_ARB, but after setting i'm not getting the valid pixel format.

in documentation it is written like that
" WGL_ACCELERATION_ARB
Indicates whether the pixel format is supported by the driver.
If this is set to WGL_NO_ACCELERATION_ARB then only the software
renderer supports this pixel format; if this is set to
WGL_GENERIC_ACCELERATION_ARB then the pixel format is supported
by an MCD driver; if this is set to WGL_FULL_ACCELERATION_ARB
then the pixel format is supported by an ICD driver.
"

Also when i'm checking the particular pixel format using

bool check = wglGetPixelFormatAttribivARB(m_hDC, PixelFormat, 0, 9, (const int*)pf_attr, pixVal);

//here PixelFormat is the supported pixel format of the DC through PixelFormat = ChoosePixelFormat( m_hDC, &pfd );

it is returning always false (for any pixel format). Though i'm getting a valid pixel format through

wglChoosePixelFormatARB( m_hDC,(const int*)pf_attr, NULL, 1, &pixelFormat, &count);

Please help me in this regard. Thanks

Stephen A
12-11-2009, 03:21 AM
WGL_DEPTH_BITS_ARB, 0, // At least 16 bits for depth buffer
WGL_STENCIL_BITS_ARB, 0,

You are not specifying any depth/stencil bits. Try 24/8 to see if that works (in my experience, 16/8 usually doesn't work).

ZbuffeR
12-11-2009, 03:22 AM
What is your hardware, OS, driver version ?

Do you really need to support pbuffers ? The modern replacement FBO is much easier and better compatible accross plateforms :
http://www.opengl.org/wiki/GL_EXT_framebuffer_object

Also check gamedev FBO tutorials.

him_me2
12-11-2009, 04:02 AM
hey actually i'm now getting the stencil Bits support.... actually the wglGetPixelFormatAttribivARB function was always returning the false.

him_me2
12-11-2009, 04:04 AM
Actually i'm not getting the FBO extension in my system. I'm having an low quality intel card.

But the card doesnt even list the pBuffer ext but i'm getting it to render when i'm doing??
What may be the reason??

Thanks for the reply