| Summary: | Behaviour of ChoosePixelFormat | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sam Lantinga <slouken> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED ABANDONED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | parasti+libsdl |
| Version: | 2.0.0 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
|
Description
Sam Lantinga
2006-01-24 02:39:33 UTC
The following code enumerates the existing pixel formats and returns the
index of the first matching pixel format. Returns 0 if no matching pixel
format available.
static int MyChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR *
target ) {
PIXELFORMATDESCRIPTOR pfd;
int format_num = DescribePixelFormat( hdc, 1, sizeof(pfd), NULL );
int format_idx;
for( format_idx = 1; format_idx <= format_num; format_idx++ ) {
if( !DescribePixelFormat( hdc, format_idx, sizeof(pfd), &pfd ) ) {
// error?
continue;
}
if( (pfd.dwFlags & target->dwFlags) != target->dwFlags ) continue;
if( pfd.iPixelType != target->iPixelType ) continue;
if( pfd.cColorBits < target->cColorBits ) continue;
if( pfd.cRedBits < target->cRedBits ) continue;
if( pfd.cGreenBits < target->cGreenBits ) continue;
if( pfd.cBlueBits < target->cBlueBits ) continue;
if( pfd.cAlphaBits < target->cAlphaBits ) continue;
if( pfd.cAccumBits < target->cAccumBits ) continue;
if( pfd.cAccumRedBits < target->cAccumRedBits ) continue;
if( pfd.cAccumGreenBits < target->cAccumGreenBits ) continue;
if( pfd.cAccumBlueBits < target->cAccumBlueBits ) continue;
if( pfd.cAccumAlphaBits < target->cAccumAlphaBits ) continue;
if( pfd.cDepthBits < target->cDepthBits ) continue;
if( pfd.cStencilBits < target->cStencilBits ) continue;
return format_idx;
}
return 0;
};
Setting Sam as "QA Contact" on all bugs (even resolved ones) so he'll definitely be in the loop to any further discussion here about SDL. --ryan. At this point, I don't want to introduce a change in 1.2 that would cause an OpenGL context to fail when it didn't previously, even if it makes it more consistent across platforms. It might be worth making a change like this in 1.3, but we would need to make a more robust pixel format choosing function - one that tries to get a closest match rather than just enforcing a minimum. This is fixed in 1.3 in subversion revision 3150. Hi, We're currently having to work around an issue in SDL2 that seems to be directly related to this old bug report. There is still some inconsistent behavior when it comes to handling attributes such as SDL_GL_MULTISAMPLESAMPLES. Requesting an excessive number of samples fails on Linux, but succeeds on Windows resulting in a context below minimum specifications: https://github.com/Neverball/neverball/issues/49 Hello, and sorry if you're getting dozens of copies of this message by email. We are closing out bugs that appear to be abandoned in some form. This can happen for lots of reasons: we couldn't reproduce it, conversation faded out, the bug was noted as fixed in a comment but we forgot to mark it resolved, the report is good but the fix is impractical, we fixed it a long time ago without realizing there was an associated report, etc. Individually, any of these bugs might have a better resolution (such as WONTFIX or WORKSFORME or INVALID) but we've added a new resolution of ABANDONED to make this easily searchable and make it clear that it's not necessarily unreasonable to revive a given bug report. So if this bug is still a going concern and you feel it should still be open: please feel free to reopen it! But unless you respond, we'd like to consider these bugs closed, as many of them are several years old and overwhelming our ability to prioritize recent issues. (please note that hundred of bug reports were sorted through here, so we apologize for any human error. Just reopen the bug in that case!) Thanks, --ryan. |