Magnum::GL::AbstractQuery class

Base class for queries.

See PrimitiveQuery, SampleQuery and TimeQuery documentation for more information.

Base classes

class AbstractObject
Base for all OpenGL objects.

Derived classes

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 -> std::string
Query label.
auto setLabel(const std::string& label) -> AbstractQuery&
Set query label.
template<std::size_t size>
auto setLabel(const char(&label)[size]) -> AbstractQuery&
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.

std::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(const std::string& 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.

template<std::size_t size>
AbstractQuery& Magnum::GL::AbstractQuery::setLabel(const char(&label)[size])

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

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().