PDA

View Full Version : GL_NV_multisample_coverage & Texture alpha



Devdept2
02-01-2011, 02:35 AM
Hi,

in my application if there is support for GL_NV_multisample_coverage extension, I ask for a CSAA Pixel format.
The ChoosePixelFormatARB returns a pixel format without alpha bits

+----+-----+----------+--------+------+------------------+----+----+----+---------------+
| ID | Type| Flags | Buffer | pType| Color |Dept|Alph|Sten| Accum |
+----+-----+----------+--------+------+------------------+----+----+----+---------------+
| 83 | ICD | 00008205 | DOUBLE | RGBA | 32 ( 8- 8- 8- 0) | 24 | 0 | 64 | (16-16-16-16) |

Why is that?
This is the code I use to get the pixel format.
Am I missing something in the parameters I pass to the ChoosePixelFormatARB() function?




int ChooseBestCSAAPixelFormat(IntPtr testHdc, out int samples, wglChoosePixelFormatARB ChoosePixelFormatARB)
{

samples = 0;

const int WGL_SAMPLE_BUFFERS_ARB = 0x2041;
const int WGL_COVERAGE_SAMPLES_NV = 0x2042;
const int WGL_COLOR_SAMPLES_NV = 0x20B9;
const int WGL_DOUBLE_BUFFER_ARB = 0x2011;

CSAAPixelFormat[] csaaPixelFormats = new CSAAPixelFormat[]
{
new CSAAPixelFormat(4, 8, "8x CSAA"),
new CSAAPixelFormat(4, 16, "16x CSAA"),
new CSAAPixelFormat(8, 8, "8xQ (Quality) CSAA"),
new CSAAPixelFormat(8, 16, "16xQ (Quality) CSAA")
};

int totalCSAAFormats = csaaPixelFormats.Length; // static_cast<int>(sizeof (csaaPixelFormats)/ sizeof (CSAAPixelFormat));

int[] attributes = new int[]
{
WGL_SAMPLE_BUFFERS_ARB, 1,
WGL_COLOR_SAMPLES_NV, 0,
WGL_COVERAGE_SAMPLES_NV, 0,
WGL_DOUBLE_BUFFER_ARB, 1,
0,0
};

int returnedPixelFormat;
uint numFormats;
bool bStatus;

for (int i = totalCSAAFormats - 1; i >= 0; --i)
{

attributes[3] = samples = csaaPixelFormats[i].numColorSamples;
attributes[5] = csaaPixelFormats[i].numCoverageSamples;

bStatus = ChoosePixelFormatARB(testHdc, attributes, null, 1, out returnedPixelFormat, out numFormats);

if (bStatus &amp;&amp; numFormats > 0)
{
#if DEBUG
PFList(testHdc); // Prints pixel format details
#endif
return returnedPixelFormat;
}
}

return 0;

}