wx.glcanvas.GLAttribsBase¶
This is the base class for wx.glcanvas.GLAttributes and 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
Added in version 4.1/wxWidgets-3.1.0.
See also
wx.glcanvas.GLCanvas, wx.glcanvas.GLContext, wx.glcanvas.GLContextAttrs, wx.glcanvas.GLAttributes
Class Hierarchy¶
Known Subclasses¶
wx.glcanvas.GLAttributes, wx.glcanvas.GLContextAttrs
Methods Summary¶
Constructor. |
|
Combine (bitwise |
|
Adds an integer value to the list of attributes. |
|
Returns the size of the internal list of attributes. |
|
Returns the current value of the ARB-flag. |
|
Delete contents and sets ARB-flag to |
|
Sets the necessity of using special ARB-functions (e.g. |
Properties Summary¶
See |
Class API¶
- class wx.glcanvas.GLAttribsBase(object)¶
Possible constructors:
GLAttribsBase() -> None
This is the base class for GLAttributes and GLContextAttrs.
Methods¶
- __init__(self)¶
Constructor.
- Return type:
None
- 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.
- Parameters:
searchVal (int) – The identifier to search for.
combineVal (int) – The value to combine with the existing one.
- Return type:
None
- AddAttribute(self, attribute)¶
Adds an integer value to the list of attributes.
- Parameters:
attribute (int) – The value to add.
- Return type:
None
- 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’.
- Return type:
int
- NeedsARB(self)¶
Returns the current value of the ARB-flag.
- Return type:
bool
See also
- Reset(self)¶
Delete contents and sets ARB-flag to
False
.- Return type:
None
- 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.
- Parameters:
needsARB (bool) –
True
if an ARB-function is needed for any of the attributes.- Return type:
None
See also
Properties¶