Last change
on this file since 2892 was
2877,
checked in by ldelgass, 12 years ago
|
Some minor refactoring, also add some more fine grained config.h defines
(e.g. replace NV40 define with feature defines). Add tests for some required
OpenGL extensions (should always check for extensions or base version before
calling entry points from the extension). Also, clamp diffuse and specular
values on input and warn when they are out of range.
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Rev | Line | |
---|
[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 | * |
---|
| 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 | */ |
---|
[2877] | 16 | #include <assert.h> |
---|
[983] | 17 | |
---|
| 18 | #include "PerfQuery.h" |
---|
| 19 | |
---|
[2877] | 20 | PerfQuery::PerfQuery() |
---|
| 21 | { |
---|
| 22 | glGenQueriesARB(1, &id); |
---|
| 23 | pixel = 0; |
---|
[983] | 24 | } |
---|
| 25 | |
---|
[2877] | 26 | PerfQuery::~PerfQuery() |
---|
| 27 | { |
---|
| 28 | glDeleteQueriesARB(1, &id); |
---|
[983] | 29 | } |
---|
| 30 | |
---|
| 31 | //There can only be one active query at any given moment |
---|
[2877] | 32 | void PerfQuery::enable() |
---|
| 33 | { |
---|
| 34 | glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id); |
---|
[983] | 35 | } |
---|
| 36 | |
---|
[2877] | 37 | void PerfQuery::disable() |
---|
| 38 | { |
---|
| 39 | glEndQueryARB(GL_SAMPLES_PASSED_ARB); |
---|
[983] | 40 | |
---|
[2877] | 41 | GLuint count; |
---|
| 42 | glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, &count); |
---|
[983] | 43 | |
---|
[2877] | 44 | //accumulate pixel count count |
---|
| 45 | pixel += count; |
---|
[983] | 46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.