X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fquery.cpp;h=13b62801133f29636511b9fe1e55c74d628bfa11;hp=a6d77eda0b604863fce53f418f31c47edbb93108;hb=8e58fc4da8443cb67fe4cd70d6f68de2be73011d;hpb=052b85720688900bc36f8844a94269cb1c0cdd52 diff --git a/source/core/query.cpp b/source/core/query.cpp index a6d77eda..13b62801 100644 --- a/source/core/query.cpp +++ b/source/core/query.cpp @@ -1,48 +1,21 @@ -#include -#include -#include #include "query.h" #include "renderer.h" -using namespace std; - namespace Msp { namespace GL { QueryPool::QueryPool(QueryType t, unsigned s): + QueryPoolBackend(t), type(t), - gl_type(get_gl_query_type(type)) + size(0) { - if(type==OCCLUSION_QUERY) - { - static Require req(ARB_occlusion_query); - static Require req2(ARB_occlusion_query2); - } - resize(s); } -QueryPool::~QueryPool() -{ - glDeleteQueries(queries.size(), queries.data()); -} - void QueryPool::resize(unsigned s) { - if(sold_size) - glGenQueries(s-old_size, queries.data()+old_size); -} - -unsigned QueryPool::get_result(unsigned i) const -{ - unsigned result = 0; - glGetQueryObjectuiv(queries[i], GL_QUERY_RESULT, &result); - return result; + size = s; + QueryPoolBackend::resize(); } @@ -59,15 +32,5 @@ QueryPool::Activate::~Activate() renderer.end_query(pool, index); } - -unsigned get_gl_query_type(QueryType t) -{ - switch(t) - { - case OCCLUSION_QUERY: return GL_ANY_SAMPLES_PASSED; - default: throw invalid_argument("get_gl_query_type"); - } -} - } // namespace GL } // namespace Msp