.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.glcanvas.GLAttributes: ========================================================================================================================================== |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 :meth:`~wx.glcanvas.GLAttributes.EndList` must be used as the last attribute. Not adding it will likely result in nothing displayed at all. .. versionadded:: 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 :meth:`~wx.glcanvas.GLAttribsBase.AddAttribute` and :meth:`~wx.glcanvas.GLAttribsBase.AddAttribBits` functions inherited from the base :ref:`wx.glcanvas.GLAttribsBase` class. While WGL_/GLX_/NS attributes can be added, ``PFD_`` (for MSW) can not. .. seealso:: :ref:`wx.glcanvas.GLCanvas`, :ref:`wx.glcanvas.GLContext`, :ref:`wx.glcanvas.GLAttribsBase`, :ref:`wx.glcanvas.GLContextAttrs` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class GLAttributes:
| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.glcanvas.GLAttributes.AuxBuffers` Specifies the number of auxiliary buffers. :meth:`~wx.glcanvas.GLAttributes.BufferSize` Specifies the number of bits for colour buffer. :meth:`~wx.glcanvas.GLAttributes.Defaults` wxWidgets defaults: ``RGBA``, Z-depth 16 bits, double buffering, 1 sample buffer, 4 samplers. :meth:`~wx.glcanvas.GLAttributes.Depth` Specifies number of bits for Z-buffer. :meth:`~wx.glcanvas.GLAttributes.DoubleBuffer` Requests using double buffering. :meth:`~wx.glcanvas.GLAttributes.EndList` The set of attributes must end with this one; otherwise, the ``GPU`` may display nothing at all. :meth:`~wx.glcanvas.GLAttributes.FrameBuffersRGB` Used to request a frame buffer sRGB capable. :meth:`~wx.glcanvas.GLAttributes.Level` Specifies the framebuffer level. :meth:`~wx.glcanvas.GLAttributes.MinAcumRGBA` Specifies the minimal number of bits for each accumulator channel. :meth:`~wx.glcanvas.GLAttributes.MinRGBA` Specifies the minimal number of bits for each colour and alpha. :meth:`~wx.glcanvas.GLAttributes.PlatformDefaults` Set some typically needed attributes. :meth:`~wx.glcanvas.GLAttributes.RGBA` Use ``True`` colour instead of colour index rendering for each pixel. :meth:`~wx.glcanvas.GLAttributes.SampleBuffers` Use multi-sampling support (antialiasing). :meth:`~wx.glcanvas.GLAttributes.Samplers` Specifies the number of samplers per pixel. :meth:`~wx.glcanvas.GLAttributes.Stencil` Specifies number of bits for stencil buffer. :meth:`~wx.glcanvas.GLAttributes.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). .. method:: AuxBuffers(self, val) Specifies the number of auxiliary buffers. :param `val`: The number of auxiliary buffers. :type `val`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: BufferSize(self, val) Specifies the number of bits for colour buffer. For ``RGBA`` it's normally the sum of the bits per each component. :param `val`: The number of bits. :type `val`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: Defaults(self) wxWidgets defaults: ``RGBA``, Z-depth 16 bits, double buffering, 1 sample buffer, 4 samplers. :rtype: :ref:`wx.glcanvas.GLAttributes` .. seealso:: :meth:`PlatformDefaults` .. method:: Depth(self, val) Specifies number of bits for Z-buffer. :param `val`: Number of bits for Z-buffer (typically 0, 16 or 32). :type `val`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: DoubleBuffer(self) Requests using double buffering. :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: EndList(self) The set of attributes must end with this one; otherwise, the ``GPU`` may display nothing at all. .. method:: FrameBuffersRGB(self) Used to request a frame buffer sRGB capable. It makes no effect for macOS. :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: Level(self, val) Specifies the framebuffer level. It makes no effect for macOS. :param `val`: 0 for main buffer, >0 for overlay, <0 for underlay. :type `val`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: 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. :param `mRed`: The minimal number of bits for red accumulator. :type `mRed`: int :param `mGreen`: The minimal number of bits for green accumulator. :type `mGreen`: int :param `mBlue`: The minimal number of bits for blue accumulator. :type `mBlue`: int :param `mAlpha`: The minimal number of bits for alpha accumulator. :type `mAlpha`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: 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. :param `mRed`: The minimal number of bits for colour red. :type `mRed`: int :param `mGreen`: The minimal number of bits for colour green. :type `mGreen`: int :param `mBlue`: The minimal number of bits for colour blue. :type `mBlue`: int :param `mAlpha`: The minimal number of bits for alpha channel. :type `mAlpha`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: PlatformDefaults(self) Set some typically needed attributes. E.g. full-acceleration on MSW. :rtype: :ref:`wx.glcanvas.GLAttributes` .. seealso:: :meth:`Defaults` .. method:: RGBA(self) Use ``True`` colour instead of colour index rendering for each pixel. It makes no effect for macOS. :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: SampleBuffers(self, val) Use multi-sampling support (antialiasing). :param `val`: Number of sample buffers, usually 1. :type `val`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: Samplers(self, val) Specifies the number of samplers per pixel. :param `val`: Number of samplers, e.g. 4 for 2x2 antialiasing. :type `val`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: Stencil(self, val) Specifies number of bits for stencil buffer. :param `val`: Number of bits. :type `val`: int :rtype: :ref:`wx.glcanvas.GLAttributes` .. method:: Stereo(self) Use stereoscopic display. :rtype: :ref:`wx.glcanvas.GLAttributes`