Ignore:
Timestamp:
04/30/08 10:09:52 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2667 r2669  
    3131#include <QVBoxLayout> 
    3232 
    33 namespace GtpVisibilityPreprocessor { 
    34  
     33namespace GtpVisibilityPreprocessor  
     34{ 
    3535 
    3636   
     
    4141static CGprofile sCgFragmentProfile; 
    4242 
    43  
    44 //static vector<OcclusionQuery *> sQueries; 
    4543 
    4644QtGlRendererWidget *rendererWidget = NULL; 
     
    8886                                                                           ViewCellsManager *viewcells, 
    8987                                                                           KdTree *tree): 
    90 QGLPixelBuffer(QSize(w, h), QGLFormat(QGL::StencilBuffer | QGL::DirectRendering | QGL::DepthBuffer | QGL::Rgba)), 
     88QGLPixelBuffer(QSize(w, h),  
     89                           QGLFormat(QGL::StencilBuffer |  
     90                                                 QGL::DepthBuffer |  
     91                                                 QGL::DoubleBuffer | 
     92                                                 QGL::Rgba 
     93                                                 )), 
    9194GlRendererBuffer(sceneGraph, viewcells, tree) 
    9295{ 
     
    125128        MakeCurrent(); 
    126129         
    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 
    131135        float pErrorPixels = -1.0f; 
    132136 
     
    134138        unsigned int pixelCount = 0; 
    135139 
    136  
     140         
    137141        ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 
    138142 
    139143        if (viewcell == NULL) 
    140144                return -1.0f; 
     145 
     146        KdNode::NewMail2(); 
     147        Intersectable::NewMail(); 
    141148 
    142149        ObjectPvs pvs; 
     
    150157                mViewCellsManager->ApplyFilter2(viewcell, false, mViewCellsManager->GetFilterWidth(), pvs); 
    151158 
    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  
    165159        pvsSize = pvs.GetSize(); 
    166  
    167         Intersectable::NewMail(); 
    168160         
    169161        if (pvsSize == 0) 
    170162                return 0.0f; 
    171163 
    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                 
    175197        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); 
    176206 
    177207        glStencilFunc(GL_EQUAL, 0x0, 0x1); 
    178208        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 
    179218        glEnable(GL_STENCIL_TEST);  
    180  
    181219        glColor3f(1,0,0); 
    182220 
    183221 
    184         OcclusionQuery *query = mOcclusionQueries[1]; 
    185  
     222        // render scene, record differences 
     223        OcclusionQuery *query = mOcclusionQueries[0]; 
     224 
     225        KdNode::NewMail2(); 
    186226        Intersectable::NewMail(); 
    187227 
     
    236276                                } 
    237277                } 
    238  
     278                 
     279 
     280#if 0 
    239281                mUseFalseColors = false; 
     282 
    240283                glPushAttrib(GL_CURRENT_BIT); 
    241                 glColor3f(0,1,0); 
     284                glColor3f(0, 1, 0); 
     285                 
    242286                glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    243287                //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    244288                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 
    245289 
     290                KdNode::NewMail2(); 
     291                Intersectable::NewMail(); 
     292 
    246293                RenderPvs(pvs); 
    247294 
     295                glFinish(); 
     296 
    248297                mUseForcedColors = false; 
     298 
    249299                im = toImage(); 
    250300                sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); 
     
    252302                qstr = str.c_str(); 
    253303                im.save(qstr, "PNG"); 
     304                 
    254305                glPopAttrib(); 
     306#endif 
    255307        } 
    256308 
     
    449501        int indexBufferSize = 0; 
    450502         
     503        // super hack: mal not working with multiple threads 
    451504        KdNode::NewMail2(); 
    452505        //Intersectable::NewMail(); 
     
    503556 
    504557        EnableDrawArrays(); 
    505         //Intersectable::NewMail(); 
    506          
     558                 
    507559        if (mDetectEmptyViewSpace)  
    508560                glEnable(GL_CULL_FACE); 
Note: See TracChangeset for help on using the changeset viewer.