source: nanovis/branches/1.1/PerfQuery.cpp @ 5406

Last change on this file since 5406 was 4889, checked in by ldelgass, 9 years ago

Merge r3611:3618 from trunk

  • Property svn:eol-style set to native
File size: 1.2 KB
RevLine 
[2798]1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
[983]2/*
3 * ----------------------------------------------------------------------
4 * PerfQuery.cpp: performance query class
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
[3502]10 *  Copyright (c) 2004-2013  HUBzero Foundation, LLC
[983]11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
[2877]16#include <assert.h>
[983]17
18#include "PerfQuery.h"
19
[4889]20using namespace nv;
21
[2877]22PerfQuery::PerfQuery()
23{
24    glGenQueriesARB(1, &id);
25    pixel = 0;
[983]26}
27
[2877]28PerfQuery::~PerfQuery()
29{
30    glDeleteQueriesARB(1, &id);
[983]31}
32
33//There can only be one active query at any given moment
[2877]34void PerfQuery::enable()
35{
36    glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
[983]37}
38
[2877]39void PerfQuery::disable()
40{
41    glEndQueryARB(GL_SAMPLES_PASSED_ARB);
[983]42
[2877]43    GLuint count;
44    glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, &count);
[983]45
[2877]46    //accumulate pixel count count
47    pixel += count;
[983]48}
Note: See TracBrowser for help on using the repository browser.