Ignore:
Timestamp:
01/21/07 00:14:50 (17 years ago)
Author:
bittner
Message:

renderer code updates for pixel error measurements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r1997 r2002  
    8383 
    8484 
    85  
     85// reimplemented here so that we can snap the error windows 
    8686float 
    8787QtGlRendererBuffer::GetPixelError(int &pvsSize) 
     
    9696  unsigned int pixelCount; 
    9797 
    98   //static int query = -1; 
    99   //if (query == -1) 
    100   //      glGenOcclusionQueriesNV(1, (unsigned int *)&query); 
    101  
    102   OcclusionQuery query; 
    10398 
    10499  ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 
    105100  if (viewcell == NULL) 
    106101        return 0.0f; 
    107  
    108   if (mDetectEmptyViewSpace) { 
    109         // now check whether any backfacing polygon would pass the depth test 
    110         SetupCamera(); 
    111         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    112         glEnable( GL_CULL_FACE ); 
    113         glCullFace(GL_BACK); 
    114  
    115         cout<<"RS "; 
    116         RenderScene(); 
    117          
    118         glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
    119         glDepthMask(GL_FALSE); 
    120         glDisable( GL_CULL_FACE ); 
    121  
    122         query.BeginQuery(); 
    123          
    124         cout<<"RS "; 
    125         RenderScene(); 
    126         cout<<"RS3 "; 
    127          
    128         query.EndQuery(); 
    129          
    130         // at this point, if possible, go and do some other computation 
    131         glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    132         glDepthMask(GL_TRUE); 
    133         glEnable( GL_CULL_FACE ); 
    134          
    135         // reenable other state 
    136         pixelCount = query.GetQueryResult(); 
    137         cout<<"RS4 "; 
    138          
    139         if (pixelCount > 0) 
    140           return -1.0f; // backfacing polygon found -> not a valid viewspace sample 
    141  
    142   } else 
    143         glDisable( GL_CULL_FACE ); 
    144          
    145  
     102   
    146103  //  ViewCell *viewcell = NULL; 
    147104   
     
    182139   
    183140  mUseFalseColors = true; 
    184    
    185   query.BeginQuery(); 
     141 
     142  OcclusionQuery *query = mOcclusionQueries[0]; 
     143 
     144  query->BeginQuery(); 
    186145   
    187146  SetupCamera(); 
     
    189148  RenderScene(); 
    190149   
    191   query.EndQuery(); 
    192    
     150  query->EndQuery(); 
    193151   
    194152  // reenable other state 
    195   pixelCount = query.GetQueryResult(); 
    196    
     153  //  int wait=0; 
     154  //  while (!query.ResultAvailable()) { 
     155  //    wait++; 
     156  //  } 
     157 
     158  pixelCount = query->GetQueryResult(); 
    197159   
    198160  pErrorPixels = ((float)pixelCount)/(GetWidth()*GetHeight()); 
    199  
    200    
    201   if (mSnapErrorFrames && pErrorPixels > 0.001f) { 
     161   
     162   
     163  if (mSnapErrorFrames && pErrorPixels > 0.01f) { 
    202164         
    203165        char filename[256]; 
Note: See TracChangeset for help on using the changeset viewer.