phoenix_title 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.

New 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 Class Hierarchy

Inheritance diagram for class GLAttributes:

method_summary Methods Summary

AuxBuffers

Specifies the number of auxiliary buffers.

BufferSize

Specifies the number of bits for colour buffer.

Defaults

wxWidgets defaults: RGBA, Z-depth 16 bits, double buffering, 1 sample buffer, 4 samplers.

Depth

Specifies number of bits for Z-buffer.

DoubleBuffer

Requests using double buffering.

EndList

The set of attributes must end with this one; otherwise, the GPU may display nothing at all.

FrameBuffersRGB

Used to request a frame buffer sRGB capable.

Level

Specifies the framebuffer level.

MinAcumRGBA

Specifies the minimal number of bits for each accumulator channel.

MinRGBA

Specifies the minimal number of bits for each colour and alpha.

PlatformDefaults

Set some typically needed attributes.

RGBA

Use True colour instead of colour index rendering for each pixel.

SampleBuffers

Use multi-sampling support (antialiasing).

Samplers

Specifies the number of samplers per pixel.

Stencil

Specifies number of bits for stencil buffer.

Stereo

Use stereoscopic display.


api 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:

wx.glcanvas.GLAttributes



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:

wx.glcanvas.GLAttributes



Defaults(self)

wxWidgets defaults: RGBA, Z-depth 16 bits, double buffering, 1 sample buffer, 4 samplers.

Return type:

wx.glcanvas.GLAttributes

See also

PlatformDefaults



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:

wx.glcanvas.GLAttributes



DoubleBuffer(self)

Requests using double buffering.

Return type:

wx.glcanvas.GLAttributes



EndList(self)

The set of attributes must end with this one; otherwise, the GPU may display nothing at all.



FrameBuffersRGB(self)

Used to request a frame buffer sRGB capable.

It makes no effect for macOS.

Return type:

wx.glcanvas.GLAttributes



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:

wx.glcanvas.GLAttributes



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:

wx.glcanvas.GLAttributes



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:

wx.glcanvas.GLAttributes



PlatformDefaults(self)

Set some typically needed attributes.

E.g. full-acceleration on MSW.

Return type:

wx.glcanvas.GLAttributes

See also

Defaults



RGBA(self)

Use True colour instead of colour index rendering for each pixel.

It makes no effect for macOS.

Return type:

wx.glcanvas.GLAttributes



SampleBuffers(self, val)

Use multi-sampling support (antialiasing).

Parameters:

val (int) – Number of sample buffers, usually 1.

Return type:

wx.glcanvas.GLAttributes



Samplers(self, val)

Specifies the number of samplers per pixel.

Parameters:

val (int) – Number of samplers, e.g. 4 for 2x2 antialiasing.

Return type:

wx.glcanvas.GLAttributes



Stencil(self, val)

Specifies number of bits for stencil buffer.

Parameters:

val (int) – Number of bits.

Return type:

wx.glcanvas.GLAttributes



Stereo(self)

Use stereoscopic display.

Return type:

wx.glcanvas.GLAttributes