source: trunk/packages/vizservers/nanovis/PerfQuery.cpp @ 1353

Last change on this file since 1353 was 983, checked in by gah, 16 years ago
File size: 1.1 KB
Line 
1
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 *
10 *  Copyright (c) 2004-2006  Purdue Research Foundation
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 */
16
17#include <assert.h>
18#include "PerfQuery.h"
19
20
21PerfQuery::PerfQuery(){
22  glGenQueriesARB(1, &id);
23  pixel = 0;
24}
25
26PerfQuery::~PerfQuery(){
27  glDeleteQueriesARB(1, &id);
28}
29
30//There can only be one active query at any given moment
31void PerfQuery::enable(){
32  glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
33}
34
35void PerfQuery::disable(){
36  glEndQueryARB(GL_SAMPLES_PASSED_ARB);
37
38  GLuint count;
39  glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, &count);
40
41  //accumulate pixel count count
42  pixel+=count;
43}
44
Note: See TracBrowser for help on using the repository browser.