Changeset 2693


Ignore:
Timestamp:
05/21/08 02:53:16 (16 years ago)
Author:
mattausch
Message:

started on dynamic object interaction

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

Legend:

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

    r2689 r2693  
    25192519} 
    25202520 
    2521 } 
     2521 
     2522 
     2523Vector3 QtGlRendererWidget::Unproject(int x, int y) 
     2524{ 
     2525        // swap y coordinate 
     2526        //y = GetHeight() - y; 
     2527 
     2528        // HACK: should come from camera! 
     2529        double projection[16];  
     2530        glGetDoublev(GL_PROJECTION_MATRIX, projection);  
     2531        double modelview[16]; 
     2532        glGetDoublev(GL_MODELVIEW_MATRIX, modelview);  
     2533 
     2534        const int viewport[4] = {0,0, GetWidth(), GetHeight()}; 
     2535 
     2536        float z; 
     2537        glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); 
     2538 
     2539        RenderScene(); 
     2540 
     2541        GLdouble rx, ry, rz; 
     2542        gluUnProject(x, y, z, modelview, projection, viewport, &rx, &ry, &rz); 
     2543 
     2544        return Vector3(rx, ry, rz); 
     2545} 
     2546 
     2547 
     2548} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h

    r2686 r2693  
    313313        void WriteViewCellInfos(); 
    314314 
     315        /** Unproject x/y screen coordinates. 
     316        */ 
     317        Vector3 Unproject(int x, int y); 
    315318         
    316319 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface05.vcproj

    r2681 r2693  
    225225                        </File> 
    226226                        <File 
     227                                RelativePath=".\ObjectPlacer.h" 
     228                                > 
     229                        </File> 
     230                        <File 
    227231                                RelativePath="QtGlRenderer.cpp" 
    228232                                > 
     
    248252                        <File 
    249253                                RelativePath="LogWriter.h" 
     254                                > 
     255                        </File> 
     256                        <File 
     257                                RelativePath=".\ObjectPlacer.cpp" 
    250258                                > 
    251259                        </File> 
Note: See TracChangeset for help on using the changeset viewer.