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

==========================================================================================================================================
|phoenix_title|  **wx.glcanvas.GLAttribsBase**
==========================================================================================================================================

This is the base class for :ref:`wx.glcanvas.GLAttributes`  and :ref:`wx.glcanvas.GLContextAttrs`.          

It stores internally the list required by OS and OpenGL driver for setting display and rendering context attributes. 

Normally this class is not used directly. But there's a case where it its member functions are useful: setting attributes not handled by wxWidgets. Suppose the OpenGL Board sets a new functionality of the context, by adding a new attribute (let's call it ``NEW_CTX_F``) and also a new type of context by allowing a new bit value (let's call it ``NEW_BITS``) for the ``CONTEXT_PROFILE_MASK_ARB`` value. These new values can be added to the list using code like this: 

::

    cxtAttrs = wx.glcanvas.GLContextAttrs()
    # Some values
    cxtAttrs.CoreProfile().OGLVersion(5, 0) # OGL 5.0, whenever available
    cxtAttrs.PlatformDefaults()

    # Values usually are platform-dependant named (even value assigned!)
    if '__WXMSW__' in wx.PlatformInfo:
        cxtAttrs.AddAttribute(WGL_NEW_CTX_F)
        cxtAttrs.AddAttribBits(WGL_CONTEXT_PROFILE_MASK_ARB, WGL_NEW_BITS)

    cxtAttrs.EndList() # Don't forget self
    cxtAttrs.SetNeedsARB(True) # Context attributes are set by an ARB-function







         



.. versionadded:: 4.1/wxWidgets-3.1.0  
    







.. seealso:: :ref:`wx.glcanvas.GLCanvas`, :ref:`wx.glcanvas.GLContext`, :ref:`wx.glcanvas.GLContextAttrs`, :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>GLAttribsBase</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.GLAttribsBase_inheritance.png" alt="Inheritance diagram of GLAttribsBase" 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.GLAttribsBase.html" title="wx.glcanvas.GLAttribsBase" alt="" coords="5,5,204,35"/> </map> 
   </p>
   </div>

|


|sub_classes| Known Subclasses
==============================

:ref:`wx.glcanvas.GLAttributes`, :ref:`wx.glcanvas.GLContextAttrs`

|


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

================================================================================ ================================================================================
:meth:`~wx.glcanvas.GLAttribsBase.__init__`                                      Constructor.
:meth:`~wx.glcanvas.GLAttribsBase.AddAttribBits`                                 Combine (bitwise ``wx.OR``) a given value with the existing one, if any.
:meth:`~wx.glcanvas.GLAttribsBase.AddAttribute`                                  Adds an integer value to the list of attributes.
:meth:`~wx.glcanvas.GLAttribsBase.GetSize`                                       Returns the size of the internal list of attributes.
:meth:`~wx.glcanvas.GLAttribsBase.NeedsARB`                                      Returns the current value of the ARB-flag.
:meth:`~wx.glcanvas.GLAttribsBase.Reset`                                         Delete contents and sets ARB-flag to ``False``.
:meth:`~wx.glcanvas.GLAttribsBase.SetNeedsARB`                                   Sets the necessity of using special ARB-functions (e.g.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.glcanvas.GLAttribsBase.Size`                                          See :meth:`~wx.glcanvas.GLAttribsBase.GetSize`
================================================================================ ================================================================================


|


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


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

   **Possible constructors**::

       GLAttribsBase()
       
   
   This is the base class for GLAttributes and GLContextAttrs.



   .. method:: __init__(self)

      Constructor.                   





   .. method:: AddAttribBits(self, searchVal, combineVal)

      Combine (bitwise ``wx.OR``) a given value with the existing one, if any.                  

      This function first searches for an identifier and then combines the given value with the value right after the identifier. If the identifier is not found, two new values (i.e. the identifier and the given value) are added to the list. 




      :param `searchVal`: The identifier to search for.   
      :type `searchVal`: int
      :param `combineVal`: The value to combine with the existing one.   
      :type `combineVal`: int






                  





   .. method:: AddAttribute(self, attribute)

      Adds an integer value to the list of attributes.                  




      :param `attribute`: The value to add.   
      :type `attribute`: int




                  





   .. method:: GetSize(self)

      Returns the size of the internal list of attributes.                  

      Remember that the last value in the list must be a '0' (zero). So, a minimal list is of size = 2, the first value is meaningful and the last is '0'.                  

      :rtype: `int`








   .. method:: NeedsARB(self)

      Returns the current value of the ARB-flag.                  

                

      :rtype: `bool`







      .. seealso:: :meth:`SetNeedsARB`     








   .. method:: Reset(self)

      Delete contents and sets ARB-flag to ``False``.                   





   .. method:: SetNeedsARB(self, needsARB=True)

      Sets the necessity of using special ARB-functions (e.g.                  

      wglCreateContextAttribsARB in MSW) for some of the attributes of the list. Multi-sampling and modern context require these ARB-functions. 




      :param `needsARB`: ``True`` if an ARB-function is needed for any of the attributes.  
      :type `needsARB`: bool




                  



      .. seealso:: :meth:`NeedsARB`     








   .. attribute:: Size

      See :meth:`~wx.glcanvas.GLAttribsBase.GetSize`

