Detailed Description
The QGLAttributeSet class provides a set of QGL::VertexAttribute indexes.
QGLAttributeSet is intended for checking if a specific vertex attribute is present in a piece of geometry, or has been set on a QGLPainter during rendering operations. The members of the set are instances of QGL::VertexAttribute, with the restriction that the index must be between 0 and 31.
The most common use for this class is to determine if specific attributes have been supplied on a QGLPainter so as to adjust the current drawing effect accordingly. The following example will use a lit texture effect if texture co-ordinates were provided in the vertex bundle, or a simple lit material effect if texture co-ordinates were not provided:
painter.clearAttributes();
painter.setVertexBundle(bundle);
if (painter.attributes().contains(QGL::TextureCoord0))
painter.setStandardEffect(QGL::LitModulateTexture2D);
else
painter.setStandardEffect(QGL::LitMaterial);
It is important to clear the attributes before setting the vertex bundle, so that attributes from a previous bundle will not leak through. Multiple vertex bundles may be supplied if they contain different parts of the same logical piece of geometry.
Member Function Documentation
QGLAttributeSet::QGLAttributeSet()
Constructs an empty attribute set.
See also isEmpty().
void QGLAttributeSet::clear()
Clears this attribute set to empty.
bool QGLAttributeSet::contains(QGL::VertexAttribute attr) const
Returns true if this attribute set contains attr; false otherwise.
See also insert() and remove().
QGLAttributeSet QGLAttributeSet::fromList(const QList<QGL::VertexAttribute> & list) [static]
Returns a new attribute set that is initialized with the members of list.
See also toList() and insert().
Inserts attr into this attribute set. Note: attr must be within the range 0 to 31. Attribute indexes outside this range are ignored and not added to the set.
See also remove() and contains().
void QGLAttributeSet::intersect(const QGLAttributeSet & other)
Intersects the contents of other with this attribute set and modifies this set accordingly.
See also unite() and subtract().
bool QGLAttributeSet::isEmpty() const
Returns true if this attribute set is empty; false otherwise.
Removes attr from this attribute set.
See also insert() and contains().
void QGLAttributeSet::subtract(const QGLAttributeSet & other)
Subtracts the contents of other from this attribute set and modifies this set accordingly.
See also unite(), intersect(), and remove().
Returns the members of this attribute set as a list.
See also fromList().
void QGLAttributeSet::unite(const QGLAttributeSet & other)
Unites the contents of other with this attribute set and modifies this set accordingly.
See also intersect(), subtract(), and insert().
bool QGLAttributeSet::operator!=(const QGLAttributeSet & other) const
Returns true if this attribute set does not have the same elements as other; false otherwise.
See also operator==().
bool QGLAttributeSet::operator==(const QGLAttributeSet & other) const
Returns true if this attribute set has the same elements as other; false otherwise.
See also operator!=().