Ignore:
Timestamp:
05/24/08 11:59:35 (16 years ago)
Author:
mattausch
Message:

enabled view cell visualization

Location:
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
Files:
2 edited

Legend:

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

    r2704 r2705  
    333333                        char filename[256]; 
    334334                        //sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 
    335                         sprintf(filename, "error-frame-%04d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount); 
     335                        sprintf_s(filename, "error-frame-%04d-%04d-%08d.png", mFrame, viewcell->GetId(), pixelCount); 
    336336                        QImage im = toImage(); 
    337337                        string str = mSnapPrefix + filename; 
     
    367367 
    368368                                im = toImage(); 
    369                                 sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 
     369                                sprintf_s(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); 
    370370                                str = mSnapPrefix + filename; 
    371371                                qstr = str.c_str(); 
     
    10041004        switch (e->key())  
    10051005        { 
    1006 case Qt::Key_E: 
    1007         mRenderErrors = !mRenderErrors; 
    1008         updateGL(); 
    1009         break; 
    1010 case Qt::Key_R: 
    1011         mUseRandomColorPerPvsObject = !mUseRandomColorPerPvsObject;; 
    1012         updateGL(); 
    1013         break; 
    1014 case Qt::Key_T: 
    1015         mTopView = !mTopView; 
    1016         SetupCameraProjection(width(), height()); 
    1017         updateGL(); 
    1018         break; 
    1019 case Qt::Key_V: 
    1020         mRenderViewCells = !mRenderViewCells; 
    1021         updateGL(); 
    1022         break; 
    1023 case Qt::Key_P: 
    1024         // set random viewpoint 
    1025         mViewCellsManager->GetViewPoint(mViewPoint); 
    1026         updateGL(); 
    1027         break; 
    1028 case Qt::Key_S: { 
    1029         // set view poitn and direction 
    1030         QString text; 
    1031         bool ok; 
    1032         text.sprintf("%f %f %f", mViewPoint.x, mViewPoint.y, mViewPoint.z); 
    1033         text = QInputDialog::getText(this, 
    1034                 "Enter a view point", 
    1035                 "", 
    1036                 QLineEdit::Normal, 
    1037                 text, 
    1038                 &ok); 
    1039         if (!ok) 
     1006        case Qt::Key_E: 
     1007                mRenderErrors = !mRenderErrors; 
     1008                updateGL(); 
    10401009                break; 
    1041  
    1042         if (sscanf(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) { 
    1043                 text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z); 
     1010        case Qt::Key_R: 
     1011                mUseRandomColorPerPvsObject = !mUseRandomColorPerPvsObject;; 
     1012                updateGL(); 
     1013                break; 
     1014        case Qt::Key_T: 
     1015                mTopView = !mTopView; 
     1016                SetupCameraProjection(width(), height()); 
     1017                updateGL(); 
     1018                break; 
     1019        case Qt::Key_V: 
     1020                mRenderViewCells = !mRenderViewCells; 
     1021                updateGL(); 
     1022                break; 
     1023        case Qt::Key_P: 
     1024                // set random viewpoint 
     1025                mViewCellsManager->GetViewPoint(mViewPoint); 
     1026                updateGL(); 
     1027                break; 
     1028        case Qt::Key_S: { 
     1029                // set view poitn and direction 
     1030                QString text; 
     1031                bool ok; 
     1032                text.sprintf("%f %f %f", mViewPoint.x, mViewPoint.y, mViewPoint.z); 
    10441033                text = QInputDialog::getText(this, 
    1045                         "Enter a direction", 
     1034                        "Enter a view point", 
    10461035                        "", 
    10471036                        QLineEdit::Normal, 
     
    10501039                if (!ok) 
    10511040                        break; 
    1052                 if (sscanf(text.toAscii(), "%f %f %f", &mViewDirection.x, 
    1053                         &mViewDirection.y, &mViewDirection.z) == 3) { 
    1054                                 updateGL(); 
     1041 
     1042                if (sscanf_s(text.toAscii(), "%f %f %f", &mViewPoint.x, &mViewPoint.y, &mViewPoint.z) == 3) { 
     1043                        text.sprintf("%f %f %f", mViewDirection.x, mViewDirection.y, mViewDirection.z); 
     1044                        text = QInputDialog::getText(this, 
     1045                                "Enter a direction", 
     1046                                "", 
     1047                                QLineEdit::Normal, 
     1048                                text, 
     1049                                &ok); 
     1050                        if (!ok) 
     1051                                break; 
     1052                        if (sscanf_s(text.toAscii(), "%f %f %f", &mViewDirection.x, 
     1053                                &mViewDirection.y, &mViewDirection.z) == 3) { 
     1054                                        updateGL(); 
    10551055                        } 
    10561056                        break; 
    1057         } 
    1058                                 } 
    1059 default: 
    1060         cerr << "unknown key" << endl; 
    1061         e->ignore(); 
    1062         break; 
     1057                } 
     1058                                        } 
     1059        default: 
     1060                cerr << "unknown key" << endl; 
     1061                e->ignore(); 
     1062                break; 
    10631063        } 
    10641064} 
     
    27002700        SetupCamera(); 
    27012701 
    2702         for (size_t i = 0; i < GetPreprocessor()->mDynamicObjects.size(); ++ i) 
     2702        for (GLuint i = 0; i < GetPreprocessor()->mDynamicObjects.size(); ++ i) 
    27032703        { 
    27042704                glLoadName(i); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp

    r2686 r2705  
    6060void QtGlViewer::RenderScene() 
    6161{ 
    62         GLfloat mat_ambient[]   = {  0.5, 0.5, 0.5, 1.0  }; 
     62        GLfloat mat_ambient[]   = {0.5f, 0.5f, 0.5f, 1.0f}; 
    6363         
    6464        // mat_specular and mat_shininess are NOT default values 
    65         GLfloat mat_diffuse[]   = {  1.0, 1.0, 1.0, 1.0  }; 
    66         GLfloat mat_specular[]  = {  0.3, 0.3, 0.3, 1.0  }; 
    67         GLfloat mat_shininess[] = {  1.0  }; 
    68  
    69         GLfloat light_ambient[]  = {  0.2f, 0.2f, 0.2f, 1.0f  }; 
    70         GLfloat light_diffuse[]  = {  0.4f, 0.4f, 0.4f, 1.0f  }; 
    71         GLfloat light_specular[] = {  0.3f, 0.3f, 0.3f, 1.0f }; 
     65        GLfloat mat_diffuse[]   = {1.0f, 1.0f, 1.0f, 1.0f}; 
     66        GLfloat mat_specular[]  = {0.3f, 0.3f, 0.3f, 1.0f}; 
     67        GLfloat mat_shininess[] = {1.0f  }; 
     68 
     69        GLfloat light_ambient[]  = {0.2f, 0.2f, 0.2f, 1.0f}; 
     70        GLfloat light_diffuse[]  = {0.4f, 0.4f, 0.4f, 1.0f}; 
     71        GLfloat light_specular[] = {0.3f, 0.3f, 0.3f, 1.0f}; 
    7272 
    7373        GLfloat lmodel_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 
     
    7575 
    7676        // set position of the light 
    77         GLfloat infinite_light[] = {1.0, 0.8, 1.0, 0.0}; 
     77        GLfloat infinite_light[] = {1.0f, 0.8f, 1.0f, 0.0f}; 
    7878        glLightfv (GL_LIGHT0, GL_POSITION, infinite_light); 
    7979 
    8080        // set position of the light2 
    81         GLfloat infinite_light2[] = {-0.3, 1.5, 1.0, 0.0}; 
     81        GLfloat infinite_light2[] = {-0.3f, 1.5f, 1.0f, 0.0f}; 
    8282        glLightfv (GL_LIGHT1, GL_POSITION, infinite_light2); 
    8383 
Note: See TracChangeset for help on using the changeset viewer.