Magnum::GL::Renderer class

Global renderer configuration.

Public types

enum class PolygonFacing: GLenum { Front = GL_FRONT, Back = GL_BACK, FrontAndBack = GL_FRONT_AND_BACK }
Affected polygon facing for culling, stencil operations and masks.

Renderer features

enum class Feature: GLenum { BlackholeRender = GL_BLACKHOLE_RENDER_INTEL new in Git master, BlendAdvancedCoherent = GL_BLEND_ADVANCED_COHERENT_KHR, Blending = GL_BLEND, ClipDistance0 = GL_CLIP_DISTANCE0 new in 2020.06, ClipDistance1 = GL_CLIP_DISTANCE1 new in 2020.06, ClipDistance2 = GL_CLIP_DISTANCE2 new in 2020.06, ClipDistance3 = GL_CLIP_DISTANCE3 new in 2020.06, ClipDistance4 = GL_CLIP_DISTANCE4 new in 2020.06, ClipDistance5 = GL_CLIP_DISTANCE5 new in 2020.06, ClipDistance6 = GL_CLIP_DISTANCE6 new in 2020.06, ClipDistance7 = GL_CLIP_DISTANCE7 new in 2020.06, DebugOutput = GL_DEBUG_OUTPUT, DebugOutputSynchronous = GL_DEBUG_OUTPUT_SYNCHRONOUS, DepthClamp = GL_DEPTH_CLAMP, DepthTest = GL_DEPTH_TEST, Dithering = GL_DITHER, FaceCulling = GL_CULL_FACE, FramebufferSrgb = GL_FRAMEBUFFER_SRGB, LogicOperation = GL_COLOR_LOGIC_OP, Multisampling = GL_MULTISAMPLE, PolygonOffsetFill = GL_POLYGON_OFFSET_FILL, PolygonOffsetLine = GL_POLYGON_OFFSET_LINE, PolygonOffsetPoint = GL_POLYGON_OFFSET_POINT, ProgramPointSize = GL_PROGRAM_POINT_SIZE, RasterizerDiscard = GL_RASTERIZER_DISCARD, SampleAlphaToCoverage = GL_SAMPLE_ALPHA_TO_COVERAGE new in Git master, SampleAlphaToOne = GL_SAMPLE_ALPHA_TO_ONE new in Git master, SampleCoverage = GL_SAMPLE_COVERAGE new in Git master, SampleShading = GL_SAMPLE_SHADING, SeamlessCubeMapTexture = GL_TEXTURE_CUBE_MAP_SEAMLESS, ScissorTest = GL_SCISSOR_TEST, StencilTest = GL_STENCIL_TEST }
Feature.
enum class Hint: GLenum { FragmentShaderDerivative = GL_FRAGMENT_SHADER_DERIVATIVE_HINT, TextureCompression = GL_TEXTURE_COMPRESSION_HINT }
Hint.
enum class HintMode: GLenum { Fastest = GL_FASTEST, Nicest = GL_NICEST, DontCare = GL_DONT_CARE }
Hint mode.
static auto lineWidthRange() -> Range1D
Line width range.
static void enable(Feature feature)
Enable a feature.
static void enable(Feature feature, UnsignedInt drawBuffer) new in 2020.06
Enable a feature for given draw buffer.
static void disable(Feature feature)
Disable a feature.
static void disable(Feature feature, UnsignedInt drawBuffer) new in 2020.06
Disable a feature for given draw buffer.
static void setFeature(Feature feature, bool enabled)
Enable or disable a feature.
static void setFeature(Feature feature, UnsignedInt drawBuffer, bool enabled)
Enable or disable a feature for given draw buffer.
static void setHint(Hint target, HintMode mode)
Set hint.

Clearing values

static void setClearColor(const Color4& color)
Set clear color.
static void setClearDepth(Double depth)
Set clear depth.
static void setClearDepth(Float depth)
static void setClearStencil(Int stencil)
Set clear stencil.

Polygon drawing settings

enum class FrontFace: GLenum { CounterClockWise = GL_CCW, ClockWise = GL_CW }
Front facing polygon winding.
enum class ProvokingVertex: GLenum { FirstVertexConvention = GL_FIRST_VERTEX_CONVENTION, LastVertexConvention = GL_LAST_VERTEX_CONVENTION }
Provoking vertex.
enum class PolygonMode: GLenum { Fill = GL_FILL, Line = GL_LINE, Point = GL_POINT }
Polygon mode.
static void setFrontFace(FrontFace mode)
Set front-facing polygon winding.
static void setFaceCullingMode(PolygonFacing mode)
Which polygon facing to cull.
static void setProvokingVertex(ProvokingVertex mode)
Set provoking vertex.
static void setPolygonMode(PolygonMode mode)
Set polygon drawing mode.
static void setPolygonOffset(Float factor, Float units)
Set polygon offset.
static void setLineWidth(Float width)
Set line width.
static void setPointSize(Float size)
Set point size.
static void setSampleCoverage(Float value, bool invert) new in Git master
Set sample coverage parameters.
static void setMinSampleShading(Float value)
Set min sample shading value.
static auto maxPatchVertexCount() -> UnsignedInt new in 2020.06
Max supported component patch vertex count.
static void setPatchVertexCount(UnsignedInt count) new in 2020.06
Set tessellation patch vertex count.
static void setPatchDefaultInnerLevel(const Vector2& levels) new in 2020.06
Set default patch inner tessellation level.
static void setPatchDefaultOuterLevel(const Vector4& levels) new in 2020.06
Set default patch outer tessellation level.
static auto maxClipDistances() -> UnsignedInt new in 2020.06
Max supported clip distance count.
static auto maxCullDistances() -> UnsignedInt new in 2020.06
Max supported cull distance count.
static auto maxCombinedClipAndCullDistances() -> UnsignedInt new in 2020.06
Max supported combined clip and cull distance count.

Scissor operations

static void setScissor(const Range2Di& rectangle)
Set scissor rectangle.

Stencil operations

enum class StencilFunction: GLenum { Never = GL_NEVER, Always = GL_ALWAYS, Less = GL_LESS, LessOrEqual = GL_LEQUAL, Equal = GL_EQUAL, NotEqual = GL_NOTEQUAL, GreaterOrEqual = GL_GEQUAL, Greater = GL_GREATER }
Stencil function.
enum class StencilOperation: GLenum { Keep = GL_KEEP, Zero = GL_ZERO, Replace = GL_REPLACE, Increment = GL_INCR, IncrementWrap = GL_INCR_WRAP, Decrement = GL_DECR, DecrementWrap = GL_DECR_WRAP, Invert = GL_INVERT }
Stencil operation.
static void setStencilFunction(PolygonFacing facing, StencilFunction function, Int referenceValue, UnsignedInt mask)
Set stencil function.
static void setStencilFunction(StencilFunction function, Int referenceValue, UnsignedInt mask)
Set stencil function.
static void setStencilOperation(PolygonFacing facing, StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass)
Set stencil operation.
static void setStencilOperation(StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass)
Set stencil operation.

Depth testing and clip control

enum class ClipOrigin: GLenum { LowerLeft = GL_LOWER_LEFT, UpperLeft = GL_UPPER_LEFT } new in Git master
Clip origin.
enum class ClipDepth: GLenum { NegativeOneToOne = GL_NEGATIVE_ONE_TO_ONE, ZeroToOne = GL_ZERO_TO_ONE } new in Git master
Clip depth.
using DepthFunction = StencilFunction
Depth function.
static void setDepthFunction(DepthFunction function)
Set depth function.
static void setDepthRange(Double near, Double far) new in Git master
Set depth range.
static void setDepthRange(Float near, Float far) new in Git master
static void setClipControl(ClipOrigin origin, ClipDepth depth) new in Git master
Set clipping behavior.

Masking writes

static void setColorMask(GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha)
Mask color writes.
static void setColorMask(UnsignedInt drawBuffer, GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha) new in 2020.06
Mask color writes for given draw buffer.
static void setDepthMask(GLboolean allow)
Mask depth writes.
static void setStencilMask(PolygonFacing facing, UnsignedInt allowBits)
Mask stencil writes.
static void setStencilMask(UnsignedInt allowBits)
Mask stencil writes.

Blending

You have to enable Feature::Blending first.

enum class BlendEquation: GLenum { Add = GL_FUNC_ADD, Subtract = GL_FUNC_SUBTRACT, ReverseSubtract = GL_FUNC_REVERSE_SUBTRACT, Min = GL_MIN, Max = GL_MAX, Multiply = GL_MULTIPLY_KHR, Screen = GL_SCREEN_KHR, Overlay = GL_OVERLAY_KHR, Darken = GL_DARKEN_KHR, Lighten = GL_LIGHTEN_KHR, ColorDodge = GL_COLORDODGE_KHR, ColorBurn = GL_COLORBURN_KHR, HardLight = GL_HARDLIGHT_KHR, SoftLight = GL_SOFTLIGHT_KHR, Difference = GL_DIFFERENCE_KHR, Exclusion = GL_EXCLUSION_KHR, HslHue = GL_HSL_HUE_KHR, HslSaturation = GL_HSL_SATURATION_KHR, HslColor = GL_HSL_COLOR_KHR, HslLuminosity = GL_HSL_LUMINOSITY_KHR }
Blend equation.
enum class BlendFunction: GLenum { Zero = GL_ZERO, One = GL_ONE, ConstantColor = GL_CONSTANT_COLOR, OneMinusConstantColor = GL_ONE_MINUS_CONSTANT_COLOR, ConstantAlpha = GL_CONSTANT_ALPHA, OneMinusConstantAlpha = GL_ONE_MINUS_CONSTANT_ALPHA, SourceColor = GL_SRC_COLOR, SecondSourceColor = GL_SRC1_COLOR, OneMinusSourceColor = GL_ONE_MINUS_SRC_COLOR, OneMinusSecondSourceColor = GL_ONE_MINUS_SRC1_COLOR, SourceAlpha = GL_SRC_ALPHA, SourceAlphaSaturate = GL_SRC_ALPHA_SATURATE, SecondSourceAlpha = GL_SRC1_ALPHA, OneMinusSourceAlpha = GL_ONE_MINUS_SRC_ALPHA, OneMinusSecondSourceAlpha = GL_ONE_MINUS_SRC1_ALPHA, DestinationColor = GL_DST_COLOR, OneMinusDestinationColor = GL_ONE_MINUS_DST_COLOR, DestinationAlpha = GL_DST_ALPHA, OneMinusDestinationAlpha = GL_ONE_MINUS_DST_ALPHA }
Blend function.
static void setBlendEquation(BlendEquation equation)
Set blend equation.
static void setBlendEquation(UnsignedInt drawBuffer, BlendEquation equation) new in 2020.06
Set blend equation for given draw buffer.
static void setBlendEquation(BlendEquation rgb, BlendEquation alpha)
Set blend equation separately for RGB and alpha components.
static void setBlendEquation(UnsignedInt drawBuffer, BlendEquation rgb, BlendEquation alpha) new in 2020.06
Set blend equation for given draw buffer separately for RGB and alpha components.
static void setBlendFunction(BlendFunction source, BlendFunction destination)
Set blend function.
static void setBlendFunction(UnsignedInt drawBuffer, BlendFunction source, BlendFunction destination) new in 2020.06
Set blend function for given draw buffer.
static void setBlendFunction(BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha)
Set blend function separately for RGB and alpha components.
static void setBlendFunction(UnsignedInt drawBuffer, BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha) new in 2020.06
Set blend function for given draw buffer separately for RGB and alpha components.
static void setBlendColor(const Color4& color)
Set blend color.
static void blendBarrier()
Blend barrier.

Logical operation

enum class LogicOperation: GLenum { Clear = GL_CLEAR, Set = GL_SET, Copy = GL_COPY, CopyInverted = GL_COPY_INVERTED, Noop = GL_NOOP, Invert = GL_INVERT, And = GL_AND, AndReverse = GL_AND_REVERSE, AndInverted = GL_AND_INVERTED, Nand = GL_NAND, Or = GL_OR, OrReverse = GL_OR_REVERSE, OrInverted = GL_OR_INVERTED, Nor = GL_NOR, Xor = GL_XOR, Equivalence = GL_EQUIV }
Logical operation.
static void setLogicOperation(LogicOperation operation)
Set logical operation.

Renderer synchronization

enum class MemoryBarrier: GLbitfield { VertexAttributeArray = GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT, ElementArray = GL_ELEMENT_ARRAY_BARRIER_BIT, Uniform = GL_UNIFORM_BARRIER_BIT, TextureFetch = GL_TEXTURE_FETCH_BARRIER_BIT, ShaderImageAccess = GL_SHADER_IMAGE_ACCESS_BARRIER_BIT, Command = GL_COMMAND_BARRIER_BIT, PixelBuffer = GL_PIXEL_BUFFER_BARRIER_BIT, TextureUpdate = GL_TEXTURE_UPDATE_BARRIER_BIT, BufferUpdate = GL_BUFFER_UPDATE_BARRIER_BIT, Framebuffer = GL_FRAMEBUFFER_BARRIER_BIT, TransformFeedback = GL_TRANSFORM_FEEDBACK_BARRIER_BIT, AtomicCounter = GL_ATOMIC_COUNTER_BARRIER_BIT, ShaderStorage = GL_SHADER_STORAGE_BARRIER_BIT }
Memory barrier.
using MemoryBarriers = Containers::EnumSet<MemoryBarrier>
Memory barriers.
static void flush()
Flush the pipeline.
static void finish()
Finish the pipeline.
static void setMemoryBarrier(MemoryBarriers barriers)
Set memory barrier.
static void setMemoryBarrierByRegion(MemoryBarriers barriers)
Set memory barrier by region.
static void setTextureBarrier()
Set texture barrier.

Renderer management

enum class Error: GLenum { NoError = GL_NO_ERROR, InvalidEnum = GL_INVALID_ENUM, InvalidValue = GL_INVALID_VALUE, InvalidOperation = GL_INVALID_OPERATION, InvalidFramebufferOperation = GL_INVALID_FRAMEBUFFER_OPERATION, OutOfMemory = GL_OUT_OF_MEMORY, StackUnderflow = GL_STACK_UNDERFLOW, StackOverflow = GL_STACK_OVERFLOW }
Error status.
enum class ResetNotificationStrategy: GLint { NoResetNotification = GL_NO_RESET_NOTIFICATION_ARB, LoseContextOnReset = GL_LOSE_CONTEXT_ON_RESET_ARB }
Graphics reset notification strategy.
enum class GraphicsResetStatus: GLenum { NoError = GL_NO_ERROR, GuiltyContextReset = GL_GUILTY_CONTEXT_RESET_ARB, InnocentContextReset = GL_INNOCENT_CONTEXT_RESET_ARB, UnknownContextReset = GL_UNKNOWN_CONTEXT_RESET_ARB }
Graphics reset status.
static auto error() -> Error
Error status.
static auto resetNotificationStrategy() -> ResetNotificationStrategy
Graphics reset notification strategy.
static auto graphicsResetStatus() -> GraphicsResetStatus
Check graphics reset status.

Enum documentation

enum class Magnum::GL::Renderer::PolygonFacing: GLenum

Affected polygon facing for culling, stencil operations and masks.

Enumerators
Front

Front-facing polygons

Back

Back-facing polygons

FrontAndBack

Front- and back-facing polygons

enum class Magnum::GL::Renderer::Feature: GLenum

Feature.

All features are disabled by default unless specified otherwise.

Enumerators
BlackholeRender new in Git master

Disable all rendering operations.

BlendAdvancedCoherent

Coherent advanced blending. Enabled by default if desktop/ES extension KHR_blend_equation_advanced_coherent is available. See blendBarrier() for more information.

Blending

Blending

ClipDistance0 new in 2020.06

Clip geometry against user-defined half-space 0. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 0.

ClipDistance1 new in 2020.06

Clip against user-defined half-space 1. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 1.

ClipDistance2 new in 2020.06

Clip against user-defined half-space 2. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 2.

ClipDistance3 new in 2020.06

Clip against user-defined half-space 3. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 3.

ClipDistance4 new in 2020.06

Clip against user-defined half-space 4. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 4.

ClipDistance5 new in 2020.06

Clip against user-defined half-space 5. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 5.

ClipDistance6 new in 2020.06

Clip against user-defined half-space 6. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 6.

ClipDistance7 new in 2020.06

Clip against user-defined half-space 7. This enables use of the gl_ClipDistance[] / gl_CullDistance[] GLSL builtin at index 7.

DebugOutput

Debug output. Disabled by default unless the GL context was created with debug output enabled.

DebugOutputSynchronous

Synchronous debug output. Has effect only if Feature::DebugOutput is enabled.

DepthClamp

Depth clamping. If enabled, ignores near and far clipping plane.

DepthTest

Depth test

Dithering

Dithering. Enabled by default.

FaceCulling

Back face culling

FramebufferSrgb

Perform sRGB conversion of values written to sRGB framebuffers. Disabled by default on desktop GL, enabled by default on OpenGL ES.

LogicOperation

Logical operation

Multisampling

Multisampling. Enabled by default. Note that the actual presence of this feature in default framebuffer depends on context configuration, see for example Platform::Sdl2Application::GLConfiguration::setSampleCount().

PolygonOffsetFill

Offset filled polygons

PolygonOffsetLine

Offset lines. Note that this affects only filled polygons rendered with setPolygonMode() set to PolygonMode::Line, not actual line primitives.

PolygonOffsetPoint

Offset points. Note that this affects only filled polygons rendered with setPolygonMode() set to PolygonMode::Point, not actual point primitives.

ProgramPointSize

Programmable point size. If enabled, the point size is taken from vertex/geometry shader builtin gl_PointSize.

RasterizerDiscard

Discard primitives before rasterization.

SampleAlphaToCoverage new in Git master

Transforms a fragment's alpha value into a coverage value to determine its contribution to the final pixel value in a multisampled framebuffer.

SampleAlphaToOne new in Git master

Replaces each sample alpha value by the maximum representable alpha value.

SampleCoverage new in Git master

Combines the fragment coverage with the coverage value set in setSampleCoverage().

SampleShading

Sample shading.

SeamlessCubeMapTexture

Seamless cube map texture.

ScissorTest

Scissor test

StencilTest

Stencil test

enum class Magnum::GL::Renderer::Hint: GLenum

Hint.

Enumerators
FragmentShaderDerivative

Accuracy of derivative calculation in fragment shader.

TextureCompression

Quality and performance of texture image compression.

enum class Magnum::GL::Renderer::HintMode: GLenum

Hint mode.

Enumerators
Fastest

Most efficient option.

Nicest

Most correct or highest quality option.

DontCare

No preference.

enum class Magnum::GL::Renderer::FrontFace: GLenum

Front facing polygon winding.

Enumerators
CounterClockWise

Counterclockwise polygons are front facing (default).

ClockWise

Clockwise polygons are front facing.

enum class Magnum::GL::Renderer::ProvokingVertex: GLenum

Provoking vertex.

Enumerators
FirstVertexConvention

Use first vertex of each polygon.

LastVertexConvention

Use last vertex of each polygon (default).

enum class Magnum::GL::Renderer::PolygonMode: GLenum

Polygon mode.

Enumerators
Fill

Interior of the polygon is filled (default).

Line

Boundary edges are filled. See also setLineWidth().

Point

Starts of boundary edges are drawn as points. See also setPointSize().

enum class Magnum::GL::Renderer::StencilFunction: GLenum

Stencil function.

Enumerators
Never

Never pass the test.

Always

Always pass the test.

Less

Pass when reference value is less than buffer value.

LessOrEqual

Pass when reference value is less than or equal to buffer value.

Equal

Pass when reference value is equal to buffer value.

NotEqual

Pass when reference value is not equal to buffer value.

GreaterOrEqual

Pass when reference value is greater than or equal to buffer value.

Greater

Pass when reference value is greater than buffer value.

enum class Magnum::GL::Renderer::StencilOperation: GLenum

Stencil operation.

Enumerators
Keep

Keep the current value.

Zero

Set the stencil buffer value to 0.

Replace

Set the stencil value to reference value specified by setStencilFunction().

Increment

Increment the current stencil buffer value, clamp to maximum possible value on overflow.

IncrementWrap

Increment the current stencil buffer value, wrap to zero on overflow.

Decrement

Increment the current stencil buffer value, clamp to minimum possible value on underflow.

DecrementWrap

Decrement the current stencil buffer value, wrap to maximum possible value on underflow.

Invert

Bitwise invert the current stencil buffer value.

enum class Magnum::GL::Renderer::ClipOrigin: GLenum new in Git master

Clip origin.

Enumerators
LowerLeft

Lower left

UpperLeft

Upper left

enum class Magnum::GL::Renderer::ClipDepth: GLenum new in Git master

Clip depth.

Enumerators
NegativeOneToOne

-1 to 1

ZeroToOne

0 to 1

enum class Magnum::GL::Renderer::BlendEquation: GLenum

Blend equation.

Enumerators
Add

source + destination

Subtract

source - destination

ReverseSubtract

destination - source

Min

min(source, destination)

Max

max(source, destination)

Multiply

Multiply. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

Screen

Screen. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

Overlay

Overlay. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

Darken

Darken. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

Lighten

Lighten. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

ColorDodge

Color dodge. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

ColorBurn

Color burn. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

HardLight

Hard light. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

SoftLight

Soft light. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

Difference

Difference. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

Exclusion

Exclusion. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

HslHue

HSL hue. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

HslSaturation

HSL saturation. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

HslColor

HSL color. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

HslLuminosity

HSL luminosity. Not accepted as separate parameters in setBlendEquation(BlendEquation, BlendEquation), only in setBlendEquation(BlendEquation).

enum class Magnum::GL::Renderer::BlendFunction: GLenum

Blend function.

Enumerators
Zero

Zero ( $ RGB = (0.0, 0.0, 0.0); A = 0.0 $ )

One

One ( $ RGB = (1.0, 1.0, 1.0); A = 1.0 $ )

ConstantColor

Constant color ( $ RGB = (R_c, G_c, B_c); A = A_c $ )

OneMinusConstantColor

One minus constant color ( $ RGB = (1.0 - R_c, 1.0 - G_c, 1.0 - B_c); A = 1.0 - A_c $ )

ConstantAlpha

Constant alpha ( $ RGB = (A_c, A_c, A_c); A = A_c $ )

OneMinusConstantAlpha

One minus constant alpha ( $ RGB = (1.0 - A_c, 1.0 - A_c, 1.0 - A_c); A = 1.0 - A_c $ )

SourceColor

Source color ( $ RGB = (R_{s0}, G_{s0}, B_{s0}); A = A_{s0} $ )

SecondSourceColor

Second source color ( $ RGB = (R_{s1}, G_{s1}, B_{s1}); A = A_{s1} $ )

OneMinusSourceColor

One minus source color ( $ RGB = (1.0 - R_{s0}, 1.0 - G_{s0}, 1.0 - B_{s0}); A = 1.0 - A_{s0} $ )

OneMinusSecondSourceColor

One minus second source color ( $ RGB = (1.0 - R_{s1}, 1.0 - G_{s1}, 1.0 - B_{s1}); A = 1.0 - A_{s1} $ )

SourceAlpha

Source alpha ( $ RGB = (A_{s0}, A_{s0}, A_{s0}); A = A_{s0} $ )

SourceAlphaSaturate

Saturate source alpha ( $ RGB = (f, f, f); A = 1.0; f = min(A_s, 1.0 - A_d) $ )

Can be used only in source parameter of setBlendFunction().

SecondSourceAlpha

Second source alpha ( $ RGB = (A_{s1}, A_{s1}, A_{s1}); A = A_{s1} $ )

OneMinusSourceAlpha

One minus source alpha ( $ RGB = (1.0 - A_{s0}, 1.0 - A_{s0}, 1.0 - A_{s0}); A = 1.0 - A_{s0} $ )

OneMinusSecondSourceAlpha

One minus second source alpha ( $ RGB = (1.0 - A_{s1}, 1.0 - A_{s1}, 1.0 - A_{s1}); A = 1.0 - A_{s1} $ )

DestinationColor

Destination color ( $ RGB = (R_d, G_d, B_d); A = A_d $ )

OneMinusDestinationColor

One minus source color ( $ RGB = (1.0 - R_d, 1.0 - G_d, 1.0 - B_d); A = 1.0 - A_d $ )

DestinationAlpha

Destination alpha ( $ RGB = (A_d, A_d, A_d); A = A_d $ )

OneMinusDestinationAlpha

One minus source alpha ( $ RGB = (1.0 - A_d, 1.0 - A_d, 1.0 - A_d); A = 1.0 - A_d $ )

enum class Magnum::GL::Renderer::LogicOperation: GLenum

Logical operation.

Enumerators
Clear

0

Set

1

Copy

source

CopyInverted

~source

Noop

destination

Invert

~destination

And

source & destination

AndReverse

source & ~destination

AndInverted

~source & destination

Nand

~(source & destination)

Or

source | destination

OrReverse

source | ~destination

OrInverted

~source | destination

Nor

~(source | destination)

Xor

source ^ destination

Equivalence

~(source ^ destination)

enum class Magnum::GL::Renderer::MemoryBarrier: GLbitfield

Memory barrier.

Enumerators
VertexAttributeArray

Vertex data

ElementArray

Vertex indices

Uniform

Uniforms

TextureFetch

Texture fetches

ShaderImageAccess

Shader image access

Command

Indirect command data

PixelBuffer

Pixel buffer data

TextureUpdate

Texture updates

BufferUpdate

Buffer updates

Framebuffer

Framebuffer operations

TransformFeedback

Transform feedback data

AtomicCounter

Atomic counters

ShaderStorage

Shader storage data

enum class Magnum::GL::Renderer::Error: GLenum

Error status.

Enumerators
NoError

No error has been recorded

InvalidEnum

An unacceptable value specified for enumerated argument

InvalidValue

A numeric argument is out of range

InvalidOperation

The specified operation is not allowed in the current state

InvalidFramebufferOperation

The framebuffer object is not complete.

OutOfMemory

There is not enough memory left to execute the command.

StackUnderflow

Given operation would cause an internal stack to underflow.

StackOverflow

Given operation would cause an internal stack to overflow.

enum class Magnum::GL::Renderer::ResetNotificationStrategy: GLint

Graphics reset notification strategy.

Enumerators
NoResetNotification

No reset notification, thus graphicsResetStatus() will always return GraphicsResetStatus::NoError. However this doesn't mean that the context cannot be lost.

LoseContextOnReset

Graphics reset will result in context loss, cause of the reset can be queried with graphicsResetStatus().

enum class Magnum::GL::Renderer::GraphicsResetStatus: GLenum

Graphics reset status.

Enumerators
NoError

No reset occurred since last call.

GuiltyContextReset

Reset attributable to the current context has been detected.

InnocentContextReset

Reset not attributable to the current context has been detected.

UnknownContextReset

Reset with unknown cause has been detected.

Typedef documentation

typedef StencilFunction Magnum::GL::Renderer::DepthFunction

Depth function.

typedef Containers::EnumSet<MemoryBarrier> Magnum::GL::Renderer::MemoryBarriers

Memory barriers.

Function documentation

static Range1D Magnum::GL::Renderer::lineWidthRange()

Line width range.

The result is cached, repeated queries don't result in repeated OpenGL calls. Note that lines wider than 1.0f are supported only when the context is not forward-compatible. Smooth lines are not supported by design.

static void Magnum::GL::Renderer::enable(Feature feature)

Enable a feature.

static void Magnum::GL::Renderer::enable(Feature feature, UnsignedInt drawBuffer) new in 2020.06

Enable a feature for given draw buffer.

Parameters
feature Feature to enable
drawBuffer Draw buffer index

static void Magnum::GL::Renderer::disable(Feature feature)

Disable a feature.

static void Magnum::GL::Renderer::disable(Feature feature, UnsignedInt drawBuffer) new in 2020.06

Disable a feature for given draw buffer.

Parameters
feature Feature to disable
drawBuffer Draw buffer index

static void Magnum::GL::Renderer::setFeature(Feature feature, bool enabled)

Enable or disable a feature.

Convenience equivalent to the following:

enabled ? GL::Renderer::enable(feature) : GL::Renderer::disable(feature)

Prefer to use enable() and disable() directly to avoid unnecessary branching.

static void Magnum::GL::Renderer::setFeature(Feature feature, UnsignedInt drawBuffer, bool enabled)

Enable or disable a feature for given draw buffer.

Parameters
feature Feature to toggle
drawBuffer Draw buffer index
enabled Enable or disable

static void Magnum::GL::Renderer::setHint(Hint target, HintMode mode)

Set hint.

Initial value is HintMode::DontCare for all targets.

static void Magnum::GL::Renderer::setClearColor(const Color4& color)

Set clear color.

Initial value is 0x1f1f1f_rgbf.

static void Magnum::GL::Renderer::setClearDepth(Double depth)

Set clear depth.

Initial value is 1.0. If the NV_depth_buffer_float desktop extension is available, the function uses the glClearDepthdNV() API which doesn't clamp the input to the $ [0, 1] $ range.

static void Magnum::GL::Renderer::setClearDepth(Float depth)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Initial value is 1.0f. If the NV_depth_buffer_float desktop extension is available, the function behaves exactly as setClearDepth(Double) for consistent clamping behavior between the two overloads. Otherwise, if OpenGL ES, OpenGL 4.1 or extension ARB_ES2_compatibility is available, this function uses the glClearDepthf() API. Otherwise it behaves exactly as setClearDepth(Double).

static void Magnum::GL::Renderer::setFrontFace(FrontFace mode)

Set front-facing polygon winding.

Initial value is FrontFace::CounterClockWise.

static void Magnum::GL::Renderer::setFaceCullingMode(PolygonFacing mode)

Which polygon facing to cull.

Initial value is PolygonFacing::Back. If set to both front and back, only points and lines are drawn.

static void Magnum::GL::Renderer::setProvokingVertex(ProvokingVertex mode)

Set provoking vertex.

Initial value is ProvokingVertex::LastVertexConvention.

static void Magnum::GL::Renderer::setPolygonMode(PolygonMode mode)

Set polygon drawing mode.

Initial value is PolygonMode::Fill.

static void Magnum::GL::Renderer::setPolygonOffset(Float factor, Float units)

Set polygon offset.

Parameters
factor Scale factor
units Offset units

static void Magnum::GL::Renderer::setLineWidth(Float width)

Set line width.

Initial value is 1.0f. Note that on contexts that are Context::Flag::ForwardCompatible the max supported value is 1.0f — request a non-forward-compatible context to get wide lines on supported hardware.

static void Magnum::GL::Renderer::setPointSize(Float size)

Set point size.

Initial value is 1.0f.

static void Magnum::GL::Renderer::setSampleCoverage(Float value, bool invert) new in Git master

Set sample coverage parameters.

Initial value is 1.0f and false.

static void Magnum::GL::Renderer::setMinSampleShading(Float value)

Set min sample shading value.

static UnsignedInt Magnum::GL::Renderer::maxPatchVertexCount() new in 2020.06

Max supported component patch vertex count.

The result is cached, repeated queries don't result in repeated OpenGL calls. If neither ARB_tessellation_shader (part of OpenGL 4.0) nor ANDROID_extension_pack_es31a / EXT_tessellation_shader ES extension is available, returns 0.

static void Magnum::GL::Renderer::setPatchVertexCount(UnsignedInt count) new in 2020.06

Set tessellation patch vertex count.

Specifies number of vertices that will be used to make up a single tessellation patch primitive.

static void Magnum::GL::Renderer::setPatchDefaultInnerLevel(const Vector2& levels) new in 2020.06

Set default patch inner tessellation level.

When no tessellation control shader is present, specifies the default inner tessellation levels to be used.

static void Magnum::GL::Renderer::setPatchDefaultOuterLevel(const Vector4& levels) new in 2020.06

Set default patch outer tessellation level.

When no tessellation control shader is present, specifies the default outer tessellation levels to be used.

static UnsignedInt Magnum::GL::Renderer::maxClipDistances() new in 2020.06

Max supported clip distance count.

The result is cached, repeated queries don't result in repeated OpenGL calls. If neither OpenGL 3.0 nor APPLE_clip_distance / EXT_clip_cull_distance ES extension nor WEBGL_clip_cull_distance WebGL extension (originally named EXT_clip_cull_distance) is available, returns 0.

static UnsignedInt Magnum::GL::Renderer::maxCullDistances() new in 2020.06

Max supported cull distance count.

The result is cached, repeated queries don't result in repeated OpenGL calls. If neither ARB_cull_distance (part of OpenGL 4.5) nor EXT_clip_cull_distance ES / WEBGL_clip_cull_distance WebGL extension (originally named EXT_clip_cull_distance) is available, returns 0.

static UnsignedInt Magnum::GL::Renderer::maxCombinedClipAndCullDistances() new in 2020.06

Max supported combined clip and cull distance count.

The result is cached, repeated queries don't result in repeated OpenGL calls. If neither ARB_cull_distance (part of OpenGL 4.5) nor EXT_clip_cull_distance ES / WEBGL_clip_cull_distance WebGL extension (originally named EXT_clip_cull_distance) is available, returns 0.

static void Magnum::GL::Renderer::setScissor(const Range2Di& rectangle)

Set scissor rectangle.

Initial value is set to cover whole window.

static void Magnum::GL::Renderer::setStencilFunction(PolygonFacing facing, StencilFunction function, Int referenceValue, UnsignedInt mask)

Set stencil function.

Parameters
facing Affected polygon facing
function Stencil function. Initial value is StencilFunction::Always.
referenceValue Reference value. Initial value is 0.
mask Mask for both reference and buffer value. Initial value is all 1 s.

static void Magnum::GL::Renderer::setStencilFunction(StencilFunction function, Int referenceValue, UnsignedInt mask)

Set stencil function.

The same as setStencilFunction(PolygonFacing, StencilFunction, Int, UnsignedInt) with facing set to PolygonFacing::FrontAndBack.

static void Magnum::GL::Renderer::setStencilOperation(PolygonFacing facing, StencilOperation stencilFail, StencilOperation depthFail, StencilOperation depthPass)

Set stencil operation.

Parameters
facing Affected polygon facing
stencilFail Action when stencil test fails
depthFail Action when stencil test passes, but depth test fails
depthPass Action when both stencil and depth test pass

Initial value for all fields is StencilOperation::Keep.

static void Magnum::GL::Renderer::setDepthFunction(DepthFunction function)

Set depth function.

Initial value is DepthFunction::Less.

static void Magnum::GL::Renderer::setDepthRange(Double near, Double far) new in Git master

Set depth range.

Initial value is 0.0 and 1.0. If the NV_depth_buffer_float desktop extension is available, the function uses the glDepthRangedNV() API which doesn't clamp the input to the $ [0, 1] $ range.

static void Magnum::GL::Renderer::setDepthRange(Float near, Float far) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Initial value is 0.0 and 1.0. If the NV_depth_buffer_float desktop extension is available, the function behaves exactly as setDepthRange(Double, Double) for consistent clamping behavior between the two overloads. Otherwise, if OpenGL ES, OpenGL 4.1 or extension ARB_ES2_compatibility is available, this function uses the glDepthRangef() API. Otherwise it behaves exactly as setDepthRange(Double, Double).

static void Magnum::GL::Renderer::setClipControl(ClipOrigin origin, ClipDepth depth) new in Git master

Set clipping behavior.

Initial value is ClipOrigin::LowerLeft and ClipDepth::NegativeOneToOne.

static void Magnum::GL::Renderer::setColorMask(GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha)

Mask color writes.

Parameters
allowRed Allow red channel to be written
allowGreen Allow green channel to be written
allowBlue Allow blue channel to be written
allowAlpha Allow alpha channel to be written

Set to false to disallow writing to given color channel. Initial values are all true.

static void Magnum::GL::Renderer::setColorMask(UnsignedInt drawBuffer, GLboolean allowRed, GLboolean allowGreen, GLboolean allowBlue, GLboolean allowAlpha) new in 2020.06

Mask color writes for given draw buffer.

Parameters
drawBuffer Draw buffer index
allowRed Allow red channel to be written
allowGreen Allow green channel to be written
allowBlue Allow blue channel to be written
allowAlpha Allow alpha channel to be written

static void Magnum::GL::Renderer::setDepthMask(GLboolean allow)

Mask depth writes.

Set to false to disallow writing to depth buffer. Initial value is true.

static void Magnum::GL::Renderer::setStencilMask(PolygonFacing facing, UnsignedInt allowBits)

Mask stencil writes.

Set given bit to 0 to disallow writing stencil value for given faces to it. Initial value is all 1 s.

static void Magnum::GL::Renderer::setStencilMask(UnsignedInt allowBits)

Mask stencil writes.

The same as calling setStencilMask(PolygonFacing, UnsignedInt) with facing set to PolygonFacing::FrontAndBack.

static void Magnum::GL::Renderer::setBlendEquation(BlendEquation equation)

Set blend equation.

Parameters
equation Blend equation

How to combine source color (pixel value) with destination color (framebuffer). Initial value is BlendEquation::Add.

static void Magnum::GL::Renderer::setBlendEquation(UnsignedInt drawBuffer, BlendEquation equation) new in 2020.06

Set blend equation for given draw buffer.

Parameters
drawBuffer Draw buffer index
equation Blend equation

static void Magnum::GL::Renderer::setBlendEquation(BlendEquation rgb, BlendEquation alpha)

Set blend equation separately for RGB and alpha components.

Parameters
rgb Blend equation for RGB components
alpha Blend equation for the alpha component

See setBlendEquation(BlendEquation) for more information.

static void Magnum::GL::Renderer::setBlendEquation(UnsignedInt drawBuffer, BlendEquation rgb, BlendEquation alpha) new in 2020.06

Set blend equation for given draw buffer separately for RGB and alpha components.

Parameters
drawBuffer Draw buffer index
rgb Blend equation for RGB components
alpha Blend equation for the alpha component

static void Magnum::GL::Renderer::setBlendFunction(BlendFunction source, BlendFunction destination)

Set blend function.

Parameters
source How the source blending factor is computed from pixel value. Initial value is BlendFunction::One.
destination How the destination blending factor is computed from framebuffer. Initial value is BlendFunction::Zero.

Common setup for alpha blending is the following, depending on whether your colors / textures have a premultiplied alpha (RGB channels always less than or equal to the alpha) or not:

GL::Renderer::enable(GL::Renderer::Feature::Blending);
GL::Renderer::setBlendFunction(
    GL::Renderer::BlendFunction::One, /* or SourceAlpha for non-premultiplied */
    GL::Renderer::BlendFunction::OneMinusSourceAlpha);

Note that in 3D you need to sort and render transparent objects back-to-front after all opaque objects in order for them to appear correctly. Alternatively, builtin shaders such as Shaders::FlatGL or Shaders::PhongGL support alpha masking, which works without alpha blending enabled and doesn't require depth sorting.

static void Magnum::GL::Renderer::setBlendFunction(UnsignedInt drawBuffer, BlendFunction source, BlendFunction destination) new in 2020.06

Set blend function for given draw buffer.

Parameters
drawBuffer Draw buffer index
source How the source blending factor is computed from pixel value
destination How the destination blending factor is computed from framebuffer

See setBlendFunction(BlendFunction, BlendFunction) for more information.

static void Magnum::GL::Renderer::setBlendFunction(BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha)

Set blend function separately for RGB and alpha components.

See setBlendFunction(BlendFunction, BlendFunction) for more information.

static void Magnum::GL::Renderer::setBlendFunction(UnsignedInt drawBuffer, BlendFunction sourceRgb, BlendFunction destinationRgb, BlendFunction sourceAlpha, BlendFunction destinationAlpha) new in 2020.06

Set blend function for given draw buffer separately for RGB and alpha components.

Parameters
drawBuffer Draw buffer index
sourceRgb How the source blending factor is computed from pixel value for RGB components
destinationRgb How the destination blending factor is computed from framebuffer for RGB components
sourceAlpha How the source blending factor is computed from pixel value for the alpha component
destinationAlpha How the destination blending factor is computed from framebuffer for the alpha component

See setBlendFunction(BlendFunction, BlendFunction) for more information.

static void Magnum::GL::Renderer::blendBarrier()

Blend barrier.

Specifies a boundary between passes when using advanced blend equations to ensure that each sample in the framebuffer is not touched more than once.

This is needed either when desktop/ES extension KHR_blend_equation_advanced_coherent is not available or when KHR_blend_equation_advanced_coherent is available and Feature::BlendAdvancedCoherent is turned off.

static void Magnum::GL::Renderer::setLogicOperation(LogicOperation operation)

Set logical operation.

static void Magnum::GL::Renderer::flush()

Flush the pipeline.

static void Magnum::GL::Renderer::finish()

Finish the pipeline.

Blocks until all commands in the pipeline are finished.

static void Magnum::GL::Renderer::setMemoryBarrier(MemoryBarriers barriers)

Set memory barrier.

Calling the function ensures that operations on particular data after the barrier will reflect all data modifications before the barrier.

static void Magnum::GL::Renderer::setMemoryBarrierByRegion(MemoryBarriers barriers)

Set memory barrier by region.

Behaves as setMemoryBarrier(), except that the region is narrowed around area affected by particular fragment shader, thus only the fragment shader-related barries are supported:

static void Magnum::GL::Renderer::setTextureBarrier()

Set texture barrier.

Calling the function ensures that texel fetches in drawing operations after the barrier will reflect texel writes before the barrier.

static Error Magnum::GL::Renderer::error()

Error status.

Returns error flag, if any set. If there aren't any more error flags, returns Error::NoError. Thus this function should be always called in a loop until it returns Error::NoError.

static ResetNotificationStrategy Magnum::GL::Renderer::resetNotificationStrategy()

Graphics reset notification strategy.

The result is cached, repeated queries don't result in repeated OpenGL calls. If OpenGL extension ARB_robustness or ES extension EXT_robustness is not available, this function always returns ResetNotificationStrategy::NoResetNotification.

For the reset notification to work, additionally to the extension support the context must be created with Platform::*Application::GLConfiguration::Flag::RobustAccess flag.

static GraphicsResetStatus Magnum::GL::Renderer::graphicsResetStatus()

Check graphics reset status.

Reset causes all context state to be lost. If OpenGL extension ARB_robustness or ES extension EXT_robustness is not available, this function always returns GraphicsResetStatus::NoError.

For the reset notification to work, additionally to the extension support the context must be created with Platform::*Application::GLConfiguration::Flag::RobustAccess flag.

If the reset occurs, ARB_robustness_isolation extension is supported and context is created with Platform::*Application::GLConfiguration::Flag::ResetIsolation, advertised support for ARB_robustness_application_isolation indicates that no other application on the system will be affected by the graphics reset. Advertised support for ARB_robustness_share_group_isolation indicates that no other share group will be affected by the graphics reset.

Debug& operator<<(Debug& debug, Renderer::Error value)

Debug output operator.