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

Last change on this file since 884 was 835, checked in by gah, 16 years ago

More clean up. Added dxReader.cpp

File size: 1.5 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
27inline bool check_query_support()
28{
29    int bitsSupported = -1;
30    glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB,
31                    &bitsSupported);
32    if(bitsSupported == 0) {
33        fprintf(stderr, "occlusion query not supported!\n");
34        return false;
35    } else {
36        fprintf(stderr, "Occlusion query with %d bits supported\n",
37                bitsSupported);
38        return true;
39    }
40}
41
42class PerfQuery
43{
44
45public:
46  NVISid id;
47  int pixel;
48
49  PerfQuery();
50  ~PerfQuery();
51
52  void enable();        //start counting how many pixels are rendered
53  void disable();       //stop counting
54
55  void reset();         //reset pixel count to 0;
56  int get_pixel_count();//return current pixel count
57
58};
59
60
61
62#endif
63
Note: See TracBrowser for help on using the repository browser.