Color missing in Pbuffer.

Hi Guys.
I am trying to render directly to Pbuffer to realize dynamic texture mapping.
My code works well. But the problem is: I request is 24 bit RGB and 24 depth bit.
But the reslut seems that it only give me 256 color.
I use nividia Geforce 3. My pbuffer initialization is as follows:

iattributes[niattribs]= WGL_DRAW_TO_PBUFFER_ARB;
iattributes[++niattribs] = GL_TRUE;

iattributes[++niattribs] =
iattributes[++niattribs] = GL_TRUE;

iattributes[++niattribs] = WGL_SUPPORT_OPENGL_ARB;
iattributes[++niattribs] = GL_TRUE;

iattributes[++niattribs] = WGL_PIXEL_TYPE_ARB;
iattributes[++niattribs] = WGL_TYPE_RGBA_ARB;

iattributes[++niattribs] = WGL_COLOR_BITS_ARB;
iattributes[++niattribs] = 24;
// 24-bit color bit except Alpha plane

iattributes[++niattribs] = WGL_DEPTH_BITS_ARB;
iattributes[++niattribs] = 24;
iattributes[++niattribs] = WGL_RED_BITS_ARB;
iattributes[++niattribs] = 8;

iattributes[++niattribs] = WGL_GREEN_BITS_ARB;
iattributes[++niattribs] = 8;

iattributes[++niattribs] = WGL_BLUE_BITS_ARB;
iattributes[++niattribs] = 8;

iattributes[++niattribs] = WGL_ALPHA_BITS_ARB;
iattributes[++niattribs] = 0;

iattributes[++niattribs] = WGL_STENCIL_BITS_ARB;
iattributes[++niattribs] = 1;

if ( !wglChoosePixelFormatARB( hdc, iattributes, fattributes, MAX_PFORMATS, pformat, &nformats ) )
cerr <<"pbuffer creation error: wglChoosePixelFormatARB() failed.

if ( nformats &lt;= 0 )
	cerr &lt;&lt; "pbuffer creation error:  Couldn't find a suitable pixel format.


format = pformat[0]; //it give me 48.

I know the reason why my pbuffer seems not be initialized correctly. Because my windows display mode is 16 bit: 5r 6g 5b, but my pbuffer is using 24 bit. So it can not do texture mapping corretly.

Why? does the pbuffer bpp have to match your screen bpp?

I didn’t think so. The pbuffer is independent from the screen. Why don’t you choose 32 bit color instead for the pbuffer and set your screen to 32 bpp as well. 24 bpp is known to be unsupported by most hardware, if not all.


No, I mean that I can initalize my pbuffer correctly. But when I do texture mapping from Pbuffer to framebuffer, since the pixel formats of these two buffers are not same, the mapping result is not right.
When I set windows display mode as 32 bit true color and set pbuffer 32 bit too, there is no problem.
So I just want to mention that when programmer are trying to do texture mapping using pbuffer, they must to pay attention that pixel formats of these two buffers are compatible.