Changeset 2877 for trunk/packages/vizservers/nanovis/PerfQuery.h
- Timestamp:
- Mar 23, 2012, 1:31:05 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/PerfQuery.h
r2870 r2877 16 16 * ====================================================================== 17 17 */ 18 #ifndef _PERFQUERY_H_19 #define _PERFQUERY_H_18 #ifndef PERFQUERY_H 19 #define PERFQUERY_H 20 20 21 21 #include <stdio.h> … … 25 25 #include "Trace.h" 26 26 27 //check if occlusion query is supported28 inline bool check_query_support()29 {30 int bitsSupported = -1;31 glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB,32 &bitsSupported);33 if (bitsSupported == 0) {34 TRACE("occlusion query not supported!\n");35 return false;36 } else {37 TRACE("Occlusion query with %d bits supported\n", bitsSupported);38 return true;39 }40 }41 42 27 class PerfQuery 43 28 { 44 29 public: 45 GLuint id;46 int pixel;47 48 30 PerfQuery(); 49 31 ~PerfQuery(); 50 32 51 33 void enable(); //start counting how many pixels are rendered 52 34 void disable(); //stop counting 53 35 54 36 void reset() 55 { 56 37 { 38 pixel = 0; 57 39 } 58 40 59 int get _pixel_count()41 int getPixelCount() 60 42 { 61 43 return pixel; //return current pixel count 62 44 } 45 46 static bool checkQuerySupport(); 47 48 GLuint id; 49 int pixel; 63 50 }; 64 51 52 //check if occlusion query is supported 53 inline bool PerfQuery::checkQuerySupport() 54 { 55 if (!GLEW_ARB_occlusion_query) { 56 TRACE("ARB_occlusion_query extension not supported\n"); 57 return false; 58 } 59 int bitsSupported = -1; 60 glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, 61 &bitsSupported); 62 if (bitsSupported == 0) { 63 TRACE("occlusion query not supported!\n"); 64 return false; 65 } else { 66 TRACE("Occlusion query with %d bits supported\n", bitsSupported); 67 return true; 68 } 69 } 65 70 #endif 66 71
Note: See TracChangeset
for help on using the changeset viewer.