Browse Source

Fix return value from *Query::result<bool>().

This is just a convenience wrapper around result<UnsignedInt>(), so we
can implement it using that. And return true whenever the result is
nonzero (previously was returning true for 1 and false for 0, 2, 3,
etc., which is wrong). The tests now pass again.
pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
89c7d75a45
  1. 17
      src/Query.cpp

17
src/Query.cpp

@ -90,21 +90,6 @@ bool AbstractQuery::resultAvailable() {
}
#ifndef DOXYGEN_GENERATING_OUTPUT
template<> bool AbstractQuery::result<bool>() {
CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {});
/** @todo Re-enable when extension loader is available for ES */
GLuint result;
#ifndef MAGNUM_TARGET_GLES2
glGetQueryObjectuiv(_id, GL_QUERY_RESULT, &result);
#elif defined(CORRADE_TARGET_NACL)
glGetQueryObjectuivEXT(_id, GL_QUERY_RESULT, &result);
#else
CORRADE_INTERNAL_ASSERT(false);
#endif
return result == GL_TRUE;
}
template<> UnsignedInt AbstractQuery::result<UnsignedInt>() {
CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {});
@ -120,6 +105,8 @@ template<> UnsignedInt AbstractQuery::result<UnsignedInt>() {
return result;
}
template<> bool AbstractQuery::result<bool>() { return result<UnsignedInt>() != 0; }
template<> Int AbstractQuery::result<Int>() {
CORRADE_ASSERT(!target, "AbstractQuery::result(): the query is currently running", {});

Loading…
Cancel
Save