.. 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.GLContextAttrs:

==========================================================================================================================================
|phoenix_title|  **wx.glcanvas.GLContextAttrs**
==========================================================================================================================================

This class is used for setting context attributes.          

Since OpenGL version 3.0 the ``ARB`` adds attributes time to time to the rendering context functionality. wxWidgets implements attributes up to ``OGL`` 4.5, but you can set new attributes by using :meth:`~wx.glcanvas.GLContextAttrs.AddAttribute`  and :meth:`~wx.glcanvas.GLContextAttrs.AddAttribBits`  functions inherited from the base :ref:`wx.glcanvas.GLAttribsBase`  class. 

Attributes can be chained. For example: ::

    cxtAttrs = wx.GLContextAttrs()
    cxtAttrs.CoreProfile().OGLVersion(4, 5).Robust().ResetIsolation().EndList()



Notice that :meth:`~wx.glcanvas.GLContextAttrs.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  
    







.. seealso:: :ref:`wx.glcanvas.GLCanvas`, :ref:`wx.glcanvas.GLContext`, :ref:`wx.glcanvas.GLAttribsBase`, :ref:`wx.glcanvas.GLAttributes`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GLContextAttrs</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.glcanvas.GLContextAttrs_inheritance.png" alt="Inheritance diagram of GLContextAttrs" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.glcanvas.GLContextAttrs.html" title="wx.glcanvas.GLContextAttrs" alt="" coords="5,83,212,112"/> <area shape="rect" id="node2" href="wx.glcanvas.GLAttribsBase.html" title="wx.glcanvas.GLAttribsBase" alt="" coords="9,5,208,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.glcanvas.GLContextAttrs.CompatibilityProfile`                         Request a type of context with all OpenGL features from version 1.0 to the newest available by the ``GPU`` driver.
:meth:`~wx.glcanvas.GLContextAttrs.CoreProfile`                                  Request an OpenGL core profile for the context.
:meth:`~wx.glcanvas.GLContextAttrs.DebugCtx`                                     Request debugging functionality.
:meth:`~wx.glcanvas.GLContextAttrs.ES2`                                          Request an ``ES`` or ``ES2`` ("Embedded Subsystem") context.
:meth:`~wx.glcanvas.GLContextAttrs.EndList`                                      The set of attributes must end with this one; otherwise, the ``GPU`` may display nothing at all.
:meth:`~wx.glcanvas.GLContextAttrs.ForwardCompatible`                            Request a forward-compatible context.
:meth:`~wx.glcanvas.GLContextAttrs.LoseOnReset`                                  With robustness enabled, if graphics reset happens, all context state is lost.
:meth:`~wx.glcanvas.GLContextAttrs.MajorVersion`                                 Request specific OpenGL core major version number (>= 3).
:meth:`~wx.glcanvas.GLContextAttrs.MinorVersion`                                 Request specific OpenGL core minor version number.
:meth:`~wx.glcanvas.GLContextAttrs.NoResetNotify`                                With robustness enabled, never deliver notification of reset events.
:meth:`~wx.glcanvas.GLContextAttrs.OGLVersion`                                   An easy way of requesting an OpenGL version.
:meth:`~wx.glcanvas.GLContextAttrs.PlatformDefaults`                             Set platform specific defaults.
:meth:`~wx.glcanvas.GLContextAttrs.ReleaseFlush`                                 Request OpenGL to avoid or not flushing pending commands when the context is made no longer current (released).
:meth:`~wx.glcanvas.GLContextAttrs.ResetIsolation`                               Request OpenGL to protect other applications or shared contexts from reset side-effects.
:meth:`~wx.glcanvas.GLContextAttrs.Robust`                                       Request robustness, or how OpenGL handles out-of-bounds buffer object accesses and graphics reset notification behaviours.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.glcanvas.GLContextAttrs(GLAttribsBase)

   This class is used for setting context attributes.



   .. method:: CompatibilityProfile(self)

      Request a type of context with all OpenGL features from version 1.0 to the newest available by the ``GPU`` driver.                  

      In this mode the ``GPU`` may be some slower than it would be without this compatibility attribute.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: CoreProfile(self)

      Request an OpenGL core profile for the context.                  

      If the requested OpenGL version is less than 3.2, this attribute is ignored and the functionality of the context is determined solely by the requested version.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: DebugCtx(self)

      Request debugging functionality.                  

      This tells OpenGL to prepare a set where some logs are enabled and also allows ``OGL`` to send debug messages through a callback function. 

      It has no effect under macOS.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: ES2(self)

      Request an ``ES`` or ``ES2`` ("Embedded Subsystem") context.                  

      These are special subsets of OpenGL, lacking some features of the full specification. Used mainly in embedded devices such as mobile phones. 

      It has no effect under macOS.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: EndList(self)

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





   .. method:: ForwardCompatible(self)

      Request a forward-compatible context.                  

      Forward-compatible contexts are defined only for OpenGL versions 3.0 and later. They must not support functionality marked as deprecated or removed by the requested version of the OpenGL API. 

      It has no effect under macOS.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: LoseOnReset(self)

      With robustness enabled, if graphics reset happens, all context state is lost.                  

      It has no effect under macOS.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: MajorVersion(self, val)

      Request specific OpenGL core major version number (>= 3).                  




      :param `val`: The major version number requested.  
      :type `val`: int






      :rtype: :ref:`wx.glcanvas.GLContextAttrs`



      :meth:`CoreProfile`   will result in using OpenGL version at least 3.2.                   





   .. method:: MinorVersion(self, val)

      Request specific OpenGL core minor version number.                  




      :param `val`: The minor version number requested, e.g. 2 if OpenGL 3.2 is requested.  
      :type `val`: int






      :rtype: :ref:`wx.glcanvas.GLContextAttrs`



      :meth:`CoreProfile`   will result in using OpenGL version at least 3.2.                   





   .. method:: NoResetNotify(self)

      With robustness enabled, never deliver notification of reset events.                  

      It has no effect under macOS.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: OGLVersion(self, vmayor, vminor)

      An easy way of requesting an OpenGL version.                  




      :param `vmayor`: The major version number requested, e.g. 4 if OpenGL 4.5 is requested.  
      :type `vmayor`: int
      :param `vminor`: The minor version number requested, e.g. 5 if OpenGL 4.5 is requested.  
      :type `vminor`: int








      :rtype: :ref:`wx.glcanvas.GLContextAttrs`



      :meth:`CoreProfile`   will result in using OpenGL version at least 3.2.                   





   .. method:: PlatformDefaults(self)

      Set platform specific defaults.                  

      Currently only Unix defaults are implemented: use X11 direct rendering and use X11 ``RGBA`` type.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: ReleaseFlush(self, val=1)

      Request OpenGL to avoid or not flushing pending commands when the context is made no longer current (released).                  

      If you don't specify this attribute, the ``GPU`` driver default is 'flushing'. 




      :param `val`: 0 for not flushing, 1 (wxWidgets default) for flushing pending commands.  
      :type `val`: int






      :rtype: :ref:`wx.glcanvas.GLContextAttrs`



                  





   .. method:: ResetIsolation(self)

      Request OpenGL to protect other applications or shared contexts from reset side-effects.                  

      It has no effect under macOS.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`








   .. method:: Robust(self)

      Request robustness, or how OpenGL handles out-of-bounds buffer object accesses and graphics reset notification behaviours.                  

      It has no effect under macOS.                  

      :rtype: :ref:`wx.glcanvas.GLContextAttrs`







