source: trunk/vizservers/nanovis/PerfQuery.h @ 829

Last change on this file since 829 was 377, checked in by qiaow, 18 years ago

Added PerfQuery? class for tracking number of pixels rendered on screen

File size: 1.4 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * PerfQuery.h: performance query class
4 *              It counts then number of pixels rendered on screen using
5 *              OpenGL occlusion query extension
6 *
7 * ======================================================================
8 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
9 *           Purdue Rendering and Perceptualization Lab (PURPL)
10 *
11 *  Copyright (c) 2004-2006  Purdue Research Foundation
12 *
13 *  See the file "license.terms" for information on usage and
14 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 * ======================================================================
16 */
17
18#ifndef _PERFQUERY_H_
19#define _PERFQUERY_H_
20
21#include <stdio.h>
22#include <GL/glew.h>
23
24#include "define.h"
25
26//check if occlusion query is supported
27static bool check_query_support(){
28  int bitsSupported = -1;
29  glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bitsSupported);
30  if(bitsSupported == 0) {
31    fprintf(stderr, "occlusion query not supported!\n");
32    return false;
33  }
34  else{
35    fprintf(stderr, "Occlusion query with %d bits supported\n", bitsSupported);
36    return true;
37  }
38}
39
40class PerfQuery
41{
42
43public:
44  NVISid id;
45  int pixel;
46
47  PerfQuery();
48  ~PerfQuery();
49
50  void enable();        //start counting how many pixels are rendered
51  void disable();       //stop counting
52
53  void reset();         //reset pixel count to 0;
54  int get_pixel_count();//return current pixel count
55
56};
57
58
59
60#endif
61
Note: See TracBrowser for help on using the repository browser.