Patch to add alpha, depth and stencil size properties to TOpenGLControl
Original Reporter info from Mantis: Michalis @michaliskambi
-
Reporter name: Michalis Kamburelis
Original Reporter info from Mantis: Michalis @michaliskambi
- Reporter name: Michalis Kamburelis
Description:
Attached patch adds to TCustomOpenGLControl properties to control the size of the alpha channel (in color buffer), stencil buffer and depth buffer. This allows to e.g. require a depth buffer with 24-bit precision, or to require stencil buffer with 8 bits for shadow volumes.
Default values and previous behavior:
- AlphaBits is by default 0, this follows previous behavior on all platforms.
- DepthBits is by default 16, this follows previous behavior on WinAPI. Previous GLX implementation was requesting only 1 bit (but in practice all GPUs will give at least 16, so this shouldn't be noticeable in practice),
- StencilBits is by default 0, this follows previous behavior on WinAPI. Previous GLX implementation was requesting 1 bit. I chose to use 0 by default, as this is safer, and that's why by default underlying libraries (like GLX or WinAPI) also do not guarantee any stencil buffer.
This should also close #21881 (closed). StencilBits and DepthBits are now configurable, portable and have sensible defaults (equal on all platforms).
It also contains a small fix for LGlMsCreateOpenGLContextAttrList , we allocate multi-sampling only if MultiSampling > 1, not when it's = 1 (1 sample per pixel means no multisampling).
Tested on WinAPI and GLX. Other widgetsets should compile, but they will ignore new properties.
Mantis conversion info:
- Mantis ID: 22170
- Version: 1.1 (SVN)
- Fixed in revision: r37480 (#1554267f)