Ignore:
Timestamp:
01/04/07 00:23:09 (18 years ago)
Author:
mattausch
Message:

started depth peeling

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

Legend:

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

    r1926 r1935  
    2121static CGcontext sCgContext = NULL; 
    2222static CGprogram sCgFragmentProgram = NULL; 
     23static CGprogram sCgDepthPeelingProgram = NULL; 
    2324static CGprofile sCgFragmentProfile; 
    2425 
     
    140141        if (sCgFragmentProgram) 
    141142                cgDestroyProgram(sCgFragmentProgram); 
     143        if (sCgDepthPeelingProgram) 
     144                cgDestroyProgram(sCgDepthPeelingProgram); 
    142145        if (sCgContext) 
    143146                cgDestroyContext(sCgContext); 
     
    692695        } 
    693696 
    694  
    695  
    696697        // at this point, if possible, go and do some other computation 
    697  
    698  
    699698         
    700699        // 7. The number of visible pixels is the number of sample rays which see the source 
     
    739738#endif 
    740739 
    741  
    742  
     740        //////// 
    743741        //-- cleanup 
    744  
    745742 
    746743        // reset gl state 
     
    791788 
    792789   
     790void QtGlRendererBuffer::CastGlobalLine(Beam &beam, const int samples) 
     791{ 
     792        // bind pixel shader implementing the front depth buffer functionality 
     793        cgGLBindProgram(sCgFragmentProgram); 
     794        cgGLEnableProfile(sCgFragmentProfile); 
     795 
     796        DepthPeeling(beam, samples); 
     797} 
     798 
     799 
     800void QtGlRendererBuffer::DepthPeeling(Beam &beam, const int samples) 
     801{ 
     802/*      if (rtNew->IsDoubleBuffered())  
     803                glDrawBuffer(GL_BACK); 
     804         
     805        rtNew->BeginCapture(); 
     806        { 
     807                cgGLBindProgram(passthru); 
     808                glColor3f(0,0.0,0.0); 
     809                DrawGeometry();   //just random geomerty    
     810        } 
     811        rtNew->EndCapture(); 
     812 
     813        for(int l = 0; l < mCurrentDepth; l++)  
     814        { 
     815                // Peel another layer 
     816                pingpong(); // switch pointer between rendertextures 
     817      
     818                rtNew->BeginCapture(); 
     819                { 
     820                        if (rtNew->IsDoubleBuffered())  
     821                                glDrawBuffer(GL_BACK); 
     822         
     823                        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);          
     824                         
     825                        cgGLBindProgram(fragmentProgram); 
     826                        cgGLSetTextureParameter(input1, rtOld->GetDepthTextureID()); 
     827                        cgGLEnableTextureParameter(input1); 
     828 
     829            glColor3f(0,0.0,0.0); 
     830                        DrawGeometry(); 
     831                        cgGLDisableTextureParameter(input1); 
     832                } 
     833                rtNew->EndCapture(); 
     834   }*/ 
     835} 
     836 
     837 
    793838void QtGlRendererBuffer::InitGL() 
    794839{ 
    795  makeCurrent();  
    796  GlRenderer::InitGL(); 
     840        makeCurrent();  
     841        GlRenderer::InitGL(); 
    797842 
    798843#if 1 
     
    851896  Debug << "---- PROGRAM BEGIN ----\n" << 
    852897          cgGetProgramString(sCgFragmentProgram, CG_COMPILED_PROGRAM) << "---- PROGRAM END ----\n"; 
     898 
     899 
     900  sCgDepthPeelingProgram =  
     901          cgCreateProgramFromFile(sCgContext, 
     902                                                          CG_SOURCE,  
     903                                                          "../src/depth_peeling.cg", 
     904                                                          sCgFragmentProfile, 
     905                                                          NULL,  
     906                                                          NULL); 
     907 
     908  if (!cgIsProgramCompiled(sCgDepthPeelingProgram)) 
     909          cgCompileProgram(sCgDepthPeelingProgram); 
     910 
     911  cgGLLoadProgram(sCgDepthPeelingProgram); 
     912  cgGLBindProgram(sCgDepthPeelingProgram); 
     913 
     914  Debug << "---- PROGRAM BEGIN ----\n"  
     915            << cgGetProgramString(sCgDepthPeelingProgram, CG_COMPILED_PROGRAM)  
     916                << "---- PROGRAM END ----\n"; 
    853917 
    854918#endif 
     
    17421806 
    17431807 
    1744  
    17451808void 
    17461809QtRendererControlWidget::FocusNextPvsErrorFrame(void) 
     
    17521815void 
    17531816QtRendererControlWidget::UpdatePvsErrorItem(int row, 
    1754                                                                                   GlRendererBuffer::PvsErrorEntry &pvsErrorEntry) 
     1817                                                                                        GlRendererBuffer::PvsErrorEntry &pvsErrorEntry) 
    17551818{ 
    17561819 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.h

    r1932 r1935  
    7979 
    8080        void SampleBeamContributions( 
    81                 Intersectable *sourceObject, 
    82                 Beam &beam, 
    83                 const int samples, 
    84                 BeamSampleStatistics &stat 
     81                        Intersectable *sourceObject, 
     82                        Beam &beam, 
     83                        const int samples, 
     84                        BeamSampleStatistics &stat 
    8585                ); 
    8686 
    8787        void 
    8888                SampleViewpointContributions( 
    89                 Intersectable *sourceObject, 
    90                 const Vector3 viewPoint, 
    91                 Beam &beam, 
    92                 const int desiredSamples, 
    93                 BeamSampleStatistics &stat 
     89                        Intersectable *sourceObject, 
     90                        const Vector3 viewPoint, 
     91                        Beam &beam, 
     92                        const int desiredSamples, 
     93                        BeamSampleStatistics &stat 
    9494                ); 
    9595 
     96        void CastGlobalLine(Beam &beam, 
     97                                                const int samples); 
     98 
     99        void DepthPeeling(Beam &beam, const int samples); 
     100 
    96101        void InitGL(); 
    97102 
    98         /** Computes rays from information gained with hw sampling- 
     103        /** Computes rays from information gained with hw sampling 
    99104        */ 
    100105        void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays); 
Note: See TracChangeset for help on using the changeset viewer.