Last change
on this file since 2831 was
2822,
checked in by ldelgass, 13 years ago
|
Const correctness fixes, pass vector/matrix objects by reference, various
formatting and style cleanups, don't spam syslog and uncomment openlog() call.
Still needs to be compiled with -DWANT_TRACE to get tracing, but now trace
output will be output to file in /tmp.
|
-
Property svn:eol-style set to
native
|
File size:
1.6 KB
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * ---------------------------------------------------------------------- |
---|
4 | * PerfQuery.h: performance query class |
---|
5 | * It counts then number of pixels rendered on screen using |
---|
6 | * OpenGL occlusion query extension |
---|
7 | * |
---|
8 | * ====================================================================== |
---|
9 | * AUTHOR: Wei Qiao <qiaow@purdue.edu> |
---|
10 | * Purdue Rendering and Perceptualization Lab (PURPL) |
---|
11 | * |
---|
12 | * Copyright (c) 2004-2006 Purdue Research Foundation |
---|
13 | * |
---|
14 | * See the file "license.terms" for information on usage and |
---|
15 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
16 | * ====================================================================== |
---|
17 | */ |
---|
18 | #ifndef _PERFQUERY_H_ |
---|
19 | #define _PERFQUERY_H_ |
---|
20 | |
---|
21 | #include <stdio.h> |
---|
22 | |
---|
23 | #include <GL/glew.h> |
---|
24 | |
---|
25 | #include "Trace.h" |
---|
26 | #include "define.h" |
---|
27 | |
---|
28 | //check if occlusion query is supported |
---|
29 | inline bool check_query_support() |
---|
30 | { |
---|
31 | int bitsSupported = -1; |
---|
32 | glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, |
---|
33 | &bitsSupported); |
---|
34 | if (bitsSupported == 0) { |
---|
35 | TRACE("occlusion query not supported!\n"); |
---|
36 | return false; |
---|
37 | } else { |
---|
38 | TRACE("Occlusion query with %d bits supported\n", bitsSupported); |
---|
39 | return true; |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | class PerfQuery |
---|
44 | { |
---|
45 | public: |
---|
46 | GLuint 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() |
---|
56 | { |
---|
57 | pixel = 0; |
---|
58 | } |
---|
59 | |
---|
60 | int get_pixel_count() |
---|
61 | { |
---|
62 | return pixel; //return current pixel count |
---|
63 | } |
---|
64 | }; |
---|
65 | |
---|
66 | #endif |
---|
67 | |
---|
Note: See
TracBrowser
for help on using the repository browser.