Ignore:
Timestamp:
05/23/08 05:19:59 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2695 r2696  
    290290 
    291291        // some error happened 
    292         if (1)//pixelCount > pixelThres)  
     292        if (pixelCount > pixelThres)  
    293293        { 
    294294                cout << "f " << mFrame << " id " << viewcell->GetId() << " pvs " << pvsSize  
     
    313313                        im.save(qstr, "PNG"); 
    314314 
    315 #if 1 
    316                         /////////// 
    317                         //-- output computed pvs 
    318                          
    319                         //mUseFalseColors = false; 
    320                         mUseFalseColors = true; 
    321                         glPushAttrib(GL_CURRENT_BIT); 
    322                         glColor3f(0, 1, 0); 
    323  
    324                         glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    325                         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 
    326  
    327                         KdNode::NewMail2(); 
    328                         Intersectable::NewMail(); 
    329  
    330                         ++ mCurrentFrame; 
    331  
    332                         // render pvs once 
    333                         //RenderPvs(pvs); 
    334                         RenderTrianglePvs(); 
    335  
    336                         glFlush(); 
    337  
    338                         mUseFalseColors = false; 
    339  
    340                         im = toImage(); 
    341                         sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 
    342                         str = mSnapPrefix + filename; 
    343                         qstr = str.c_str(); 
    344                         im.save(qstr, "PNG"); 
    345  
    346                         glPopAttrib(); 
    347 #endif 
     315                        if (0) 
     316                        { 
     317                                /////////// 
     318                                //-- output computed pvs 
     319 
     320                                //mUseFalseColors = false; 
     321                                mUseFalseColors = true; 
     322                                glPushAttrib(GL_CURRENT_BIT); 
     323                                glColor3f(0, 1, 0); 
     324 
     325                                glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     326                                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 
     327 
     328                                KdNode::NewMail2(); 
     329                                Intersectable::NewMail(); 
     330 
     331                                ++ mCurrentFrame; 
     332 
     333                                // render pvs once 
     334                                //RenderPvs(pvs); 
     335                                RenderTrianglePvs(); 
     336 
     337                                glFlush(); 
     338 
     339                                mUseFalseColors = false; 
     340 
     341                                im = toImage(); 
     342                                sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 
     343                                str = mSnapPrefix + filename; 
     344                                qstr = str.c_str(); 
     345                                im.save(qstr, "PNG"); 
     346 
     347                                glPopAttrib(); 
     348                        } 
    348349                } 
    349350        } 
     
    26022603} 
    26032604 
    2604 /* 
    2605  
    2606 int ExampleRenderThread::faceAtPosition(const QPoint &pos)  
     2605 
     2606int QtGlRendererWidget::FindDynamicObject(const Vector3 &pos)  
    26072607{  
    26082608        // we need to lock the rendering context  
    2609         glw.lockGLContext();  
     2609        //glw.lockGLContext();  
     2610         
    26102611        // this is the same as in every OpenGL picking example  
    2611         const int MaxSize = 512;  
     2612        const int maxSize = 512;  
     2613         
    26122614        // see below for an explanation on the buffer content  
    2613         GLuint buffer[MaxSize];  
     2615        GLuint buffer[maxSize];  
    26142616        GLint viewport[4]; 
     2617 
    26152618        glGetIntegerv(GL_VIEWPORT, viewport);  
    2616         glSelectBuffer(MaxSize, buffer);  
     2619        glSelectBuffer(maxSize, buffer);  
     2620         
    26172621        // enter select mode  
    26182622        glRenderMode(GL_SELECT);  
    26192623        glInitNames();  
    26202624        glPushName(0);  
     2625         
    26212626        glMatrixMode(GL_PROJECTION);  
    26222627        glPushMatrix();  
    26232628        glLoadIdentity();  
    2624         gluPickMatrix((GLdouble)pos.x(), 215 (GLdouble)(viewport[3] - pos.y()), 216 5.0, 5.0, viewport);  
    2625         GLfloat x = (GLfloat)viewport_size.width() / viewport_size.height();  
     2629        gluPickMatrix((GLdouble)pos.x, (GLdouble)(viewport[3] - pos.y), 5.0f, 5.0f, viewport);  
     2630         
     2631        GLfloat x = (GLfloat)width() / height();  
    26262632        glFrustum(-x, x, -1.0, 1.0, 4.0, 15.0);  
    2627         draw();  
     2633         
     2634         glLoadName(1); 
     2635 
     2636        _RenderDynamicObject(mPendingDynamicObject); 
     2637 
    26282638        glMatrixMode(GL_PROJECTION);  
    26292639        glPopMatrix(); 
     2640 
    26302641        // finally release the rendering context again  
    26312642        if (!glRenderMode(GL_RENDER))  
    26322643        {  
    2633                 glw.unlockGLContext();  
     2644                //glw.unlockGLContext();  
    26342645                return -1;  
    26352646        }  
    26362647         
    2637         glw.unlockGLContext();  
     2648        //glw.unlockGLContext();  
    26382649         
    26392650        // Each hit takes 4 items in the buffer.  
     
    26492660        return buffer[3];  
    26502661} 
    2651 */ 
    2652 } 
     2662 
     2663void processHits (GLint hits, GLuint buffer[]) 
     2664{ 
     2665   unsigned int i, j; 
     2666   GLuint names, *ptr; 
     2667 
     2668   cout << "hits = %d" << endl;; 
     2669   ptr = (GLuint *) buffer; 
     2670 
     2671   for (i = 0; i < hits; i++)  
     2672   { 
     2673           /*  for each hit  */ 
     2674           names = *ptr; 
     2675 
     2676           printf (" number of names for hit = %d\n", names); ptr++; 
     2677           printf("  z1 is %g;", (float) *ptr/0x7fffffff); ptr++; 
     2678           printf(" z2 is %g\n", (float) *ptr/0x7fffffff); ptr++; 
     2679           printf ("   the name is "); 
     2680 
     2681           for (j = 0; j < names; j++) {     /*  for each name */ 
     2682                   printf ("%d ", *ptr); ptr++; 
     2683           } 
     2684           printf ("\n"); 
     2685   } 
     2686} 
     2687 
     2688} 
Note: See TracChangeset for help on using the changeset viewer.