#include
<oglplus/capability.hpp>
Capability
This enumeration lists GL capabilities i.e. features that can be enabled,
disabled or queried by the Enable
,
Disable
and IsEnabled
member functions of the Context
class.
enum class Capability : GLenum { PrimitiveRestart = GL_PRIMITIVE_RESTART, DepthTest = GL_DEPTH_TEST, StencilTest = GL_STENCIL_TEST, ScissorTest = GL_SCISSOR_TEST, CullFace = GL_CULL_FACE, RasterizerDiscard = GL_RASTERIZER_DISCARD, PolygonOffsetPoint = GL_POLYGON_OFFSET_POINT, PolygonOffsetLine = GL_POLYGON_OFFSET_LINE, PolygonOffsetFill = GL_POLYGON_OFFSET_FILL, Blend = GL_BLEND, ColorLogicOp = GL_COLOR_LOGIC_OP, Dither = GL_DITHER, Multisample = GL_MULTISAMPLE, SampleShading = GL_SAMPLE_SHADING, LineSmooth = GL_LINE_SMOOTH, PolygonSmooth = GL_POLYGON_SMOOTH, ProgramPointSize = GL_PROGRAM_POINT_SIZE, TextureCubeMapSeamless = GL_TEXTURE_CUBE_MAP_SEAMLESS, SampleAlphaToCoverage = GL_SAMPLE_ALPHA_TO_COVERAGE, SampleAlphaToOne = GL_SAMPLE_ALPHA_TO_ONE, SampleCoverage = GL_SAMPLE_COVERAGE, SampleMask = GL_SAMPLE_MASK, FramebufferSRGB = GL_FRAMEBUFFER_SRGB, DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS, StreamRasterization = GL_STREAM_RASTERIZATION_AMD, BlendAdvancedCoherent = GL_BLEND_ADVANCED_COHERENT_KHR, FragmentCoverageToColor = GL_FRAGMENT_COVERAGE_TO_COLOR_NV }; template <> Range<Capability> EnumValueRange<Capability>(void); StrCRef EnumValueName(Capability);
For example:
Context gl; gl.Enable(Capability::DepthTest); gl.Disable(Capability::CullFace); gl.Enable(Functionality::ClipDistance, 0); gl.Disable(Functionality::ClipDistance, 1);
Capability
to class
#if !OGLPLUS_NO_ENUM_VALUE_CLASSES
namespace enums { template <typename Base, template<Capability> class Transform> class EnumToClass<Base, Capability, Transform>: public Base { public: EnumToClass(void); EnumToClass(Base&& base); Transform<Capability::PrimitiveRestart> PrimitiveRestart; Transform<Capability::DepthTest> DepthTest; Transform<Capability::StencilTest> StencilTest; Transform<Capability::ScissorTest> ScissorTest; Transform<Capability::CullFace> CullFace; Transform<Capability::RasterizerDiscard> RasterizerDiscard; Transform<Capability::PolygonOffsetPoint> PolygonOffsetPoint; Transform<Capability::PolygonOffsetLine> PolygonOffsetLine; Transform<Capability::PolygonOffsetFill> PolygonOffsetFill; Transform<Capability::Blend> Blend; Transform<Capability::ColorLogicOp> ColorLogicOp; Transform<Capability::Dither> Dither; Transform<Capability::Multisample> Multisample; Transform<Capability::SampleShading> SampleShading; Transform<Capability::LineSmooth> LineSmooth; Transform<Capability::PolygonSmooth> PolygonSmooth; Transform<Capability::ProgramPointSize> ProgramPointSize; Transform<Capability::TextureCubeMapSeamless> TextureCubeMapSeamless; Transform<Capability::SampleAlphaToCoverage> SampleAlphaToCoverage; Transform<Capability::SampleAlphaToOne> SampleAlphaToOne; Transform<Capability::SampleCoverage> SampleCoverage; Transform<Capability::SampleMask> SampleMask; Transform<Capability::FramebufferSRGB> FramebufferSRGB; Transform<Capability::DebugOutputSynchronous> DebugOutputSynchronous; Transform<Capability::StreamRasterization> StreamRasterization; Transform<Capability::BlendAdvancedCoherent> BlendAdvancedCoherent; Transform<Capability::FragmentCoverageToColor> FragmentCoverageToColor; }; } // namespace enums #endif
Specialization of EnumToClass for the Capability enumeration. |
Functionality
Functionalities are similar to capabilities in that they can be enabled,
disabled or queried by the Enable
,
Disable
and IsEnabled
member functions of the Context
class.
The difference between them is that functionalities have multiple 0-based-indexed
'slots' that can be enabled or disabled. One example of a Functionality
is ClipDistance
where the i-th 'slot' enables the i-th
clipping plane.
enum class Functionality : GLenum { ClipDistance = GL_CLIP_DISTANCE0 }; template <> Range<Functionality> EnumValueRange<Functionality>(void); StrCRef EnumValueName(Functionality);
The Capability
and Functionality
enumerations have several syntax-sugar operators allowing less verbose
use.
void operator << (Capability capability, bool enable);void operator + (Capability capability);
void operator - (Capability capability);
struct FunctionalityAndNumber { };
FunctionalityAndNumber operator | (Functionality func, GLuint number);
void operator << (FunctionalityAndNumber func_and_num, bool enable);
void operator + (FunctionalityAndNumber func_and_num);
void operator - (FunctionalityAndNumber func_and_num);
![]()
Enables or disables the specified |
|
Enables the specified |
|
Disables the specified |
|
An opaque helper type used by the |
|
Creates an instance of |
|
Enables or disables the specified functionality. |
|
Enables the specified functionality. |
|
Disables the specified functionality. |
For example:
Capability::DepthTest << true;Capability::StencilTest << false;
+Capability::CullFace;
-Capability::Blend;
for(int i=0; i<4; ++i) { (Functionality::ClipDistance | i) << true;
}