Magnum::GL::AbstractQuery class

Base class for queries.

See PipelineStatisticsQuery, PrimitiveQuery, SampleQuery and TimeQuery documentation for more information.

Base classes

class AbstractObject
Base for all OpenGL objects.

Derived classes

class PipelineStatisticsQuery new in 2020.06
Pipeline statistics query.
class PrimitiveQuery
Query for primitives.
class SampleQuery
Query for samples.
class TimeQuery
Query for elapsed time.

Constructors, destructors, conversion operators

AbstractQuery(const AbstractQuery&) deleted
Copying is not allowed.
AbstractQuery(AbstractQuery&& other) noexcept
Move constructor.
~AbstractQuery() protected
Destructor.

Public functions

auto operator=(const AbstractQuery&) -> AbstractQuery& deleted
Copying is not allowed.
auto operator=(AbstractQuery&& other) -> AbstractQuery& noexcept
Move assignment.
auto id() const -> GLuint
OpenGL query ID.
auto release() -> GLuint
Release OpenGL object.
auto label() const -> Containers::String
Query label.
auto setLabel(Containers::StringView label) -> AbstractQuery&
Set query label.
auto resultAvailable() -> bool
Whether the result is available.
template<class T>
auto result() -> T
Result.
void begin()
Begin query.
void end()
End query.

Function documentation

Magnum::GL::AbstractQuery::~AbstractQuery() protected

Destructor.

Deletes assigned OpenGL query.

GLuint Magnum::GL::AbstractQuery::release()

Release OpenGL object.

Releases ownership of OpenGL query object and returns its ID so it is not deleted on destruction. The internal state is then equivalent to moved-from state.

Containers::String Magnum::GL::AbstractQuery::label() const

Query label.

The result is not cached, repeated queries will result in repeated OpenGL calls. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither KHR_debug (covered also by ANDROID_extension_pack_es31a) nor EXT_debug_label desktop or ES extension is available, this function returns empty string.

AbstractQuery& Magnum::GL::AbstractQuery::setLabel(Containers::StringView label)

Set query label.

Returns Reference to self (for method chaining)

Default is empty string. If OpenGL 4.3 / OpenGL ES 3.2 is not supported and neither KHR_debug (covered also by ANDROID_extension_pack_es31a) nor EXT_debug_label desktop or ES extension is available, this function does nothing.

bool Magnum::GL::AbstractQuery::resultAvailable()

Whether the result is available.

template<class T>
T Magnum::GL::AbstractQuery::result()

Result.

Template parameters
T Result type. Can be either bool, UnsignedInt, Int, UnsignedLong or Long.

Note that this function is blocking until the result is available. See resultAvailable().

void Magnum::GL::AbstractQuery::begin()

Begin query.

Begins counting until end() is called.

void Magnum::GL::AbstractQuery::end()

End query.

The result can be then retrieved by calling result().