wx.glcanvas.GLAttributes¶
This class is used for setting display attributes when drawing through OpenGL (“Pixel format” in MSW and OSX parlance, “Configs” in X11).
While framebuffer depth and samplers are still common, attributes like layers overlay or not using True
colour are rarely used nowadays.
Attributes can be chained. For example:
dispAttrs = wx.glcanvas.GLAttributes()
dispAttrs.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(32).EndList()
Notice that EndList
must be used as the last attribute. Not adding it will likely result in nothing displayed at all.
Added in version 4.1/wxWidgets-3.1.0.
Note
Not all of platform-dependant available attributes are implemented in wxWidgets. You can set other attributes by using AddAttribute
and AddAttribBits
functions inherited from the base wx.glcanvas.GLAttribsBase class. While WGL_/GLX_/NS attributes can be added, PFD_
(for MSW) can not.
See also
wx.glcanvas.GLCanvas, wx.glcanvas.GLContext, wx.glcanvas.GLAttribsBase, wx.glcanvas.GLContextAttrs
Class Hierarchy¶
Methods Summary¶
Specifies the number of auxiliary buffers. |
|
Specifies the number of bits for colour buffer. |
|
wxWidgets defaults: |
|
Specifies number of bits for Z-buffer. |
|
Requests using double buffering. |
|
The set of attributes must end with this one; otherwise, the |
|
Used to request a frame buffer sRGB capable. |
|
Specifies the framebuffer level. |
|
Specifies the minimal number of bits for each accumulator channel. |
|
Specifies the minimal number of bits for each colour and alpha. |
|
Set some typically needed attributes. |
|
Use |
|
Use multi-sampling support (antialiasing). |
|
Specifies the number of samplers per pixel. |
|
Specifies number of bits for stencil buffer. |
|
Use stereoscopic display. |
Class API¶
- class wx.glcanvas.GLAttributes(GLAttribsBase)¶
This class is used for setting display attributes when drawing through OpenGL (“Pixel format” in MSW and OSX parlance, “Configs” in X11).
Methods¶
- AuxBuffers(self, val)¶
Specifies the number of auxiliary buffers.
- Parameters:
val (int) – The number of auxiliary buffers.
- Return type:
- BufferSize(self, val)¶
Specifies the number of bits for colour buffer.
For
RGBA
it’s normally the sum of the bits per each component.- Parameters:
val (int) – The number of bits.
- Return type:
- Defaults(self)¶
wxWidgets defaults:
RGBA
, Z-depth 16 bits, double buffering, 1 sample buffer, 4 samplers.- Return type:
See also
- Depth(self, val)¶
Specifies number of bits for Z-buffer.
- Parameters:
val (int) – Number of bits for Z-buffer (typically 0, 16 or 32).
- Return type:
- DoubleBuffer(self)¶
Requests using double buffering.
- Return type:
- EndList(self)¶
The set of attributes must end with this one; otherwise, the
GPU
may display nothing at all.- Return type:
None
- FrameBuffersRGB(self)¶
Used to request a frame buffer sRGB capable.
It makes no effect for macOS.
- Return type:
- Level(self, val)¶
Specifies the framebuffer level.
It makes no effect for macOS.
- Parameters:
val (int) – 0 for main buffer, >0 for overlay, <0 for underlay.
- Return type:
- MinAcumRGBA(self, mRed, mGreen, mBlue, mAlpha)¶
Specifies the minimal number of bits for each accumulator channel.
On MSW and OSX this function also sets the size of the accumulation buffer.
- Parameters:
mRed (int) – The minimal number of bits for red accumulator.
mGreen (int) – The minimal number of bits for green accumulator.
mBlue (int) – The minimal number of bits for blue accumulator.
mAlpha (int) – The minimal number of bits for alpha accumulator.
- Return type:
- MinRGBA(self, mRed, mGreen, mBlue, mAlpha)¶
Specifies the minimal number of bits for each colour and alpha.
On MSW and OSX this function also sets the size of the colour buffer.
- Parameters:
mRed (int) – The minimal number of bits for colour red.
mGreen (int) – The minimal number of bits for colour green.
mBlue (int) – The minimal number of bits for colour blue.
mAlpha (int) – The minimal number of bits for alpha channel.
- Return type:
- PlatformDefaults(self)¶
Set some typically needed attributes.
E.g. full-acceleration on MSW.
- Return type:
See also
- RGBA(self)¶
Use
True
colour instead of colour index rendering for each pixel.It makes no effect for macOS.
- Return type:
- SampleBuffers(self, val)¶
Use multi-sampling support (antialiasing).
- Parameters:
val (int) – Number of sample buffers, usually 1.
- Return type:
- Samplers(self, val)¶
Specifies the number of samplers per pixel.
- Parameters:
val (int) – Number of samplers, e.g. 4 for 2x2 antialiasing.
- Return type:
- Stencil(self, val)¶
Specifies number of bits for stencil buffer.
- Parameters:
val (int) – Number of bits.
- Return type:
- Stereo(self)¶
Use stereoscopic display.
- Return type: