PDA

View Full Version : pbuffer transparency



erol
05-04-2004, 03:27 AM
Hi,
When I try to render a frame to a texture(1024*768) via pbuffer, somehow I cannot set alpha enable. I read the extension headers and prepared the pfd as follows:


const int iAttribList[]={ WGL_DRAW_TO_PBUFFER_ARB, 1,
WGL_TRANSPARENT_ARB,1,
WGL_COLOR_BITS_ARB, 24,
WGL_ALPHA_BITS_ARB, 8,
WGL_DEPTH_BITS_ARB, 8,
WGL_STENCIL_BITS_ARB, 0,
WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV, true,
0};

const float fAttribList[]={0};
//Choose pixel format
unsigned int numFormats;
if(!wglChoosePixelFormatARB( hDC, iAttribList, fAttribList, 1, &pixelFormat, &numFormats))
{
MessageBox(NULL,"Can't find a suitable pixel format for the pbuffer","ERROR",MB_OK|MB_ICONEXCLAMATION);
return ;
}

const int otherAttribs[]={ WGL_TEXTURE_FORMAT_ARB,
WGL_TEXTURE_RGBA_ARB,
WGL_TEXTURE_TARGET_ARB,
WGL_TEXTURE_RECTANGLE_NV,
0};
//Create the pbuffer
hpbuffer = wglCreatePbufferARB(hDC, pixelFormat,1024, 768, otherAttribs);
if(!hpbuffer)
{
MessageBox(NULL,"Can't create the pbuffer","ERROR",MB_OK|MB_ICONEXCLAMATION);
return ;
}

pbufferDC = wglGetPbufferDCARB(hpbuffer);
pbufferRC = wglCreateContext(pbufferDC);
Everything is OK, but no transparency in the prepared texture :(

What is missing?
Thanks a lot.

System: Win2000, GeForceFx5200,
driver version 5.6.7.2 ( April 2004 )

plasmonster
05-04-2004, 04:58 PM
From nvidia's spec:



...
In addition the following attributes are always
ignored, even if specified: WGL_NUMBER_PIXEL_FORMATS_ARB,
WGL_RED_SHIFT_ARB,
WGL_GREEN_SHIFT_ARB,
WGL_BLUE_SHIFT_ARB,
WGL_ALPHA_SHIFT_ARB,

WGL_TRANSPARENT_ARB,
WGL_TRANSPARENT_RED_VALUE_ARB,
WGL_TRANSPARENT_GREEN_VALUE_ARB,
WGL_TRANSPARENT_BLUE_VALUE_ARB, WGL_TRANSPARENT_ALPHA_VALUE_ARB, and
WGL_TRANSPARENT_INDEX_ARB.

...
erol,

if it were supported, you would probably need to set a transparent value for r, g, b. I don't know ATI's story on this one, but I suspect it's the same.

You can read all about it here:
http://developer.nvidia.com/object/nvidia_opengl_specs.html

erol
05-04-2004, 09:32 PM
Thank you very much Portal,
You can't know how useful this is for me :)