PDA

View Full Version : Stencil Buffer Anti-Aliasing with pBuffers



hortitude
07-27-2004, 12:24 PM
I have a setup where I'm using the stencil buffer to mask out half the lines of my pbuffer. This has worked perfectly up until I started requesting an anti-aliased pbuffer.

I am currently requesting pbuffer with 4 samples

iattributes[++niattribs] = GL_SAMPLE_BUFFERS_EXT;
iattributes[++niattribs] = GL_TRUE;
iattributes[++niattribs] = WGL_SAMPLES_EXT;
iattributes[++niattribs] = 4;

When I look at the GL pipeline in the blue book it shows Stencil-Buffering happening after MultiSample, leading me to believe that what I'd like to happen should work.

I've tried both a GeForce4 and a GeForceFX 5900 on Windows 2000.

Any thoughts?

Obli
07-28-2004, 09:00 AM
Originally posted by hortitude:
I have a setup where I'm using the stencil buffer to mask out half the lines of my pbuffer. This has worked perfectly up until I started requesting an anti-aliased pbuffer.More specifically, what does not work?
Does it bombs out? Maybe it does not get a pixel format? Seems to work but doesn't to its job?

Originally posted by hortitude:
it shows Stencil-Buffering happening after MultiSample, leading me to believe that what I'd like to happen should work.Maybe, but just as AA is not supported on some cards and stencil is not on some (admitedly old) others. AA and stencil could not be supported for pbuffers.

gdewan
07-28-2004, 09:29 AM
I have sucessfully used both multisampling and stencils together on both of those cards.

This is what I used in my case:


attr_index = 0;
i_attributes[attr_index] = WGL_DRAW_TO_PBUFFER_ARB;
i_attributes[attr_index + 1] = TRUE;
attr_index += 2;

i_attributes[attr_index] = WGL_ACCELERATION_ARB;
i_attributes[attr_index + 1] = WGL_FULL_ACCELERATION_ARB;
attr_index += 2;

i_attributes[attr_index] = WGL_SUPPORT_OPENGL_ARB;
i_attributes[attr_index + 1] = TRUE;
attr_index += 2;

i_attributes[attr_index] = WGL_PIXEL_TYPE_ARB;
i_attributes[attr_index + 1] = WGL_TYPE_RGBA_ARB;
attr_index += 2;

i_attributes[attr_index] = WGL_DEPTH_BITS_ARB;
i_attributes[attr_index + 1] = 24;
attr_index += 2;

i_attributes[attr_index] = WGL_STENCIL_BITS_ARB;
i_attributes[attr_index + 1] = 8;
attr_index += 2;

i_attributes[attr_index] = WGL_RED_BITS_ARB;
i_attributes[attr_index + 1] = 8;
attr_index += 2;

i_attributes[attr_index] = WGL_GREEN_BITS_ARB;
i_attributes[attr_index + 1] = 8;
attr_index += 2;

i_attributes[attr_index] = WGL_BLUE_BITS_ARB;
i_attributes[attr_index + 1] = 8;
attr_index += 2;

i_attributes[attr_index] = WGL_ALPHA_BITS_ARB;
i_attributes[attr_index + 1] = 8;
attr_index += 2;

i_attributes[attr_index] = WGL_SAMPLE_BUFFERS_ARB;
i_attributes[attr_index + 1] = 1;
attr_index += 2;

i_attributes[attr_index] = WGL_SAMPLES_ARB;
i_attributes[attr_index + 1] = 4;It came back with 15 usable pixel formats on the 5900 Ultra.

Obli
07-28-2004, 10:00 AM
All right, I also see it's a render-to-pbuff so I should have not pointed this out in the first place.

hortitude
07-28-2004, 11:30 AM
I will try those attributes and report back.

For now, just to clarify: When I choose the pixel-format it returns 10 different formats, but when I try them, they don't seem to actually have the effect you might expect. If I setup the stencil-buffer to mask out all odd numbered lines and turn on Anti-Aliasing my graphics show up on all lines.

If I run the same code but don't use Anti-Aliasing the graphics only show up on the odd numbered lines (so I at least know that I am using the stencil buffer correctly).

gdewan
07-28-2004, 11:44 AM
Well, it is definately all working on mine. What drivers are you using? May want to try a different set to see if it might be a driver bug.