Ignore:
Timestamp:
08/28/08 21:17:15 (16 years ago)
Author:
mattausch
Message:

improved performance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2878 r2879  
    4747//-- fbos 
    4848 
    49 FrameBufferObject *fbo; 
     49FrameBufferObject *fbo = NULL; 
    5050 
    5151bool isFirstTexture = true; 
     
    376376        glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST); 
    377377 
    378         InitFBO(); 
    379          
    380378        LeftMotion(0, 0); 
    381379        MiddleMotion(0, 0); 
     
    432430        SsaoShader::Init(sCgContext); 
    433431 
    434         deferredShader = new DeferredShader(texWidth, texHeight); 
    435         ssaoShader = new SsaoShader(texWidth, texHeight, camera, myfar / 10.0f); 
     432        //deferredShader = new DeferredShader(texWidth, texHeight); 
     433        //ssaoShader = new SsaoShader(texWidth, texHeight, camera, myfar / 10.0f); 
    436434 
    437435        // initialize the render traverser 
     
    539537        // this fbo basicly stores the scene information we get from standard rendering of a frame 
    540538        // we store colors, normals, positions (for the ssao) 
    541         fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_24); 
     539        fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32); 
    542540 
    543541        // the diffuse color buffer 
     
    551549        // the normals buffer 
    552550        //fbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false); 
     551        fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false); 
     552 
     553        // another color buffer 
    553554        fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false); 
    554555 
     
    574575void InitGLstate()  
    575576{ 
    576         glClearColor(0.5f, 0.5f, 0.8f, 0.0f); 
     577        glClearColor(0.0f, 0.0, 0.2f, 0.0f); 
    577578         
    578579        glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 
     
    871872         
    872873                glEnable(GL_MULTISAMPLE_ARB); 
    873                 fbo->Release(); 
    874  
     874                 
    875875                state.SetRenderType(RenderState::FIXED); 
    876876                glEnable(GL_LIGHTING); 
     
    888888 
    889889                glEnable(GL_MULTISAMPLE_ARB); 
    890                 fbo->Release(); 
    891  
     890                 
    892891                cgGLDisableProfile(RenderState::sCgFragmentProfile); 
    893892                cgGLDisableProfile(RenderState::sCgVertexProfile); 
     
    907906         
    908907        case RenderState::DEFERRED: 
     908 
     909                if (!fbo) InitFBO(); 
    909910 
    910911                // multisampling does not work with deferred shading 
     
    987988 
    988989                if (useSsao) 
     990                { 
     991                        if (!ssaoShader) ssaoShader = new SsaoShader(texWidth, texHeight, camera, myfar / 10.0f); 
     992                        //DEL_PTR(deferredShader); 
     993                         
    989994                        ssaoShader->Render(fbo, oldViewProjMatrix, ssaoExpFactor); 
     995 
     996                } 
    990997                else 
     998                { 
     999                        if (!deferredShader) deferredShader = new DeferredShader(texWidth, texHeight); 
     1000                        //DEL_PTR(ssaoShader); 
     1001 
    9911002                        deferredShader->Render(fbo); 
     1003                } 
     1004        } 
     1005        else 
     1006        { 
     1007                /*DEL_PTR(fbo); 
     1008                DEL_PTR(ssaoShader); 
     1009                DEL_PTR(deferredShader); 
     1010                */ 
    9921011        } 
    9931012         
     
    11741193        switch (c)  
    11751194        { 
     1195 
    11761196        case 'A': 
    11771197        case 'a': 
     
    15311551        DEL_PTR(renderQueue); 
    15321552        DEL_PTR(perfGraph); 
     1553 
     1554        DEL_PTR(fbo); 
     1555        DEL_PTR(ssaoShader); 
     1556        DEL_PTR(deferredShader); 
    15331557 
    15341558        if (sCgMrtVertexProgram) 
Note: See TracChangeset for help on using the changeset viewer.