#include
<oglplus/bitfield.hpp>
The Bitfield
template serves as a wrapper for OpenGL
bitfields. It allows to combine strongly-typed enumerated values into a
single bitfield value.
Library end-user applications rarely need to use this class directly. Instantiations of this template are used as types for parameters in functions taking bitfields based on strongly-type enumerations. When constructing a bitfield the application simply passes the enumerated value or a combination of enumerated values using the bitwise-or operator or initializer list.
template <typename Bits> class Bitfield { public: Bitfield(void);Bitfield(Bits _bit);
Bitfield(Bits _bit_a, Bits _bit_b);
#if !
OGLPLUS_NO_INITIALIZER_LISTS
Bitfield(const std::initializer_list<Bits>& bits);#endif template <typename Iter> Bitfield(Iter pos, Iter end);
friend Bitfield operator | (Bitfield bf, Bits b);
Bitfield& operator |= (Bits b);
bool Test(Bits b) const;
bool Has(Bits b) const; }; template <typename Bits> Bitfield<Bits> operator | (Bits b1, Bits b2);
Constructs an empty (zero) bitfield. |
|
Construct a bitfield from a single value of |
|
Construct a bitfield from a pair of |
|
Construct a bitfield from an initializer list of |
|
Construction from a pair of iterators through |
|
Bitwise-or operator for combining |
|
Bitwise-or operator for combining |
|
These functions test if a specified bit is set. |
Context gl; gl.Clear(ClearBit::ColorBuffer);gl.Clear( ClearBit::ColorBuffer| ClearBit::DepthBuffer| ClearBit::StencilBuffer );
gl.Clear({ ClearBit::ColorBuffer, ClearBit::DepthBuffer, ClearBit::StencilBuffer });
if(gl.ProfileMask().Has(ContextProfileBit::Compatibility))
{ /* ... */ }
Initialization of a Bitfield from a single enumeration value. |
|
Initialization from a set of enumeration values. |
|
Initialization from an |
|
Testing if a particular bit is set |