Changeset 2669 for GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Timestamp:
- 04/30/08 10:09:52 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2667 r2669 31 31 #include <QVBoxLayout> 32 32 33 namespace GtpVisibilityPreprocessor {34 33 namespace GtpVisibilityPreprocessor 34 { 35 35 36 36 … … 41 41 static CGprofile sCgFragmentProfile; 42 42 43 44 //static vector<OcclusionQuery *> sQueries;45 43 46 44 QtGlRendererWidget *rendererWidget = NULL; … … 88 86 ViewCellsManager *viewcells, 89 87 KdTree *tree): 90 QGLPixelBuffer(QSize(w, h), QGLFormat(QGL::StencilBuffer | QGL::DirectRendering | QGL::DepthBuffer | QGL::Rgba)), 88 QGLPixelBuffer(QSize(w, h), 89 QGLFormat(QGL::StencilBuffer | 90 QGL::DepthBuffer | 91 QGL::DoubleBuffer | 92 QGL::Rgba 93 )), 91 94 GlRendererBuffer(sceneGraph, viewcells, tree) 92 95 { … … 125 128 MakeCurrent(); 126 129 127 /* 128 SetupCamera(); 129 RenderScene(); 130 */ 130 cout << "stencil: " << format().stencil() << endl; 131 cout << "depth: " << format().depth() << endl; 132 cout << "rgba: " << format().rgba() << endl; 133 cout << "double: " << format().doubleBuffer() << endl; 134 131 135 float pErrorPixels = -1.0f; 132 136 … … 134 138 unsigned int pixelCount = 0; 135 139 136 140 137 141 ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 138 142 139 143 if (viewcell == NULL) 140 144 return -1.0f; 145 146 KdNode::NewMail2(); 147 Intersectable::NewMail(); 141 148 142 149 ObjectPvs pvs; … … 150 157 mViewCellsManager->ApplyFilter2(viewcell, false, mViewCellsManager->GetFilterWidth(), pvs); 151 158 152 153 mUseForcedColors = true;154 155 SetupCamera();156 157 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);158 glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_FALSE);159 glColor3f(0,1,0);160 glDepthFunc(GL_LESS );161 glEnable(GL_DEPTH_TEST);162 163 glDisable(GL_STENCIL_TEST);164 165 159 pvsSize = pvs.GetSize(); 166 167 Intersectable::NewMail();168 160 169 161 if (pvsSize == 0) 170 162 return 0.0f; 171 163 172 RenderPvs(pvs); 173 174 //glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 164 mUseForcedColors = true; 165 166 SetupCamera(); 167 168 // use shading 169 if (mSnapErrorFrames) 170 { 171 172 GLfloat light_ambient[] = {0.3, 0.3, 0.3, 1.0}; 173 GLfloat light_diffuse[] = {0.6, 0.6, 0.6, 1.0}; 174 GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0}; 175 176 GLfloat light_position[] = //{278.0f, 548.8f,279.0f, 1.0f}; 177 {0.f,0.f,0.f, 1.0f}; 178 179 glEnable(GL_LIGHT0); 180 181 // a light 182 glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); 183 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); 184 glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); 185 186 glEnable(GL_LIGHTING); 187 glLightfv (GL_LIGHT0, GL_POSITION, light_position); 188 189 glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); 190 glEnable(GL_COLOR_MATERIAL); 191 192 glShadeModel(GL_SMOOTH); 193 } 194 195 glDisable(GL_ALPHA_TEST); 196 175 197 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 198 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 199 200 //glColorMask(GL_FALSE, GL_TRUE, GL_FALSE, GL_TRUE); 201 glColor3f(0, 1, 0); 202 203 glDepthFunc(GL_LESS); 204 glDepthMask(GL_TRUE); 205 glEnable(GL_DEPTH_TEST); 176 206 177 207 glStencilFunc(GL_EQUAL, 0x0, 0x1); 178 208 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 209 210 211 // render pvs once 212 RenderPvs(pvs); 213 214 //glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 215 //glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); 216 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 217 179 218 glEnable(GL_STENCIL_TEST); 180 181 219 glColor3f(1,0,0); 182 220 183 221 184 OcclusionQuery *query = mOcclusionQueries[1]; 185 222 // render scene, record differences 223 OcclusionQuery *query = mOcclusionQueries[0]; 224 225 KdNode::NewMail2(); 186 226 Intersectable::NewMail(); 187 227 … … 236 276 } 237 277 } 238 278 279 280 #if 0 239 281 mUseFalseColors = false; 282 240 283 glPushAttrib(GL_CURRENT_BIT); 241 glColor3f(0,1,0); 284 glColor3f(0, 1, 0); 285 242 286 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 243 287 //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 244 288 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 245 289 290 KdNode::NewMail2(); 291 Intersectable::NewMail(); 292 246 293 RenderPvs(pvs); 247 294 295 glFinish(); 296 248 297 mUseForcedColors = false; 298 249 299 im = toImage(); 250 300 sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); … … 252 302 qstr = str.c_str(); 253 303 im.save(qstr, "PNG"); 304 254 305 glPopAttrib(); 306 #endif 255 307 } 256 308 … … 449 501 int indexBufferSize = 0; 450 502 503 // super hack: mal not working with multiple threads 451 504 KdNode::NewMail2(); 452 505 //Intersectable::NewMail(); … … 503 556 504 557 EnableDrawArrays(); 505 //Intersectable::NewMail(); 506 558 507 559 if (mDetectEmptyViewSpace) 508 560 glEnable(GL_CULL_FACE);
Note: See TracChangeset
for help on using the changeset viewer.