Changeset 2881 for GTP/trunk


Ignore:
Timestamp:
08/29/08 00:00:59 (16 years ago)
Author:
mattausch
Message:

working quite well

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
4 edited

Legend:

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

    r2879 r2881  
    9494                magfilterParam = GL_LINEAR; break; 
    9595        case FILTER_MIPMAP_LINEAR:  
    96                 //minfilterParam = GL_LINEAR_MIPMAP_LINEAR; 
    97                 minfilterParam = GL_NEAREST_MIPMAP_NEAREST; 
    98                 //minfilterParam = GL_NEAREST_MIPMAP_LINEAR; 
    99                 magfilterParam = GL_NEAREST; break; 
     96                //minfilterParam = GL_NEAREST_MIPMAP_NEAREST; 
     97                //magfilterParam = GL_NEAREST;  
     98 
     99                minfilterParam = GL_NEAREST_MIPMAP_LINEAR; 
     100                magfilterParam = GL_LINEAR;  
     101                break; 
    100102        default: 
    101103                minfilterParam = GL_NEAREST; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp

    r2880 r2881  
    112112static void CreateNoiseTex2D(int w, int h) 
    113113{ 
    114         // hack: should be able to recalc noise texture 
    115         //if (noiseTex > 0) return; 
    116  
    117114        //GLubyte *randomNormals = new GLubyte[mWidth * mHeight * 3]; 
    118115        float *randomNormals = new float[w * h * 3]; 
     
    167164        //-- the flip-flop fbos 
    168165 
    169         w = 256; h = 256; 
     166        //w = 512; h = 512; 
    170167        mNewFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 
    171168         
     
    173170        mNewFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false); 
    174171         
     172 
     173        /////////////////////// 
     174 
    175175        mOldFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 
    176176         
     
    457457        glDrawBuffers(1, mymrt); 
    458458 
    459         glPushAttrib(GL_VIEWPORT_BIT); 
    460         glViewport(0, 0, 256, 256); 
    461  
    462         glMatrixMode(GL_PROJECTION); 
    463         glPushMatrix(); 
    464         glLoadIdentity(); 
    465  
    466         glMatrixMode(GL_MODELVIEW); 
    467         glPushMatrix(); 
    468         glLoadIdentity(); 
    469  
    470         const float offs = 0.5f; 
    471         glOrtho(-offs, offs, -offs, offs, 0, 1); 
    472  
    473459 
    474460        GLuint oldTex = mOldFbo->GetColorBuffer(0)->GetTexture(); 
     
    537523        cgGLDisableTextureParameter(sOldTexParam); 
    538524 
    539         glMatrixMode(GL_PROJECTION); 
    540         glPopMatrix(); 
    541  
    542         glMatrixMode(GL_MODELVIEW); 
    543         glPopMatrix(); 
    544  
    545         glPopAttrib(); 
    546525 
    547526        FrameBufferObject::Release(); 
     
    805784        glDrawBuffers(1, mymrt); 
    806785 
     786        cgGLEnableProfile(RenderState::sCgFragmentProfile); 
     787 
     788        cgGLBindProgram(sCgCombinedIllumProgram); 
     789 
    807790        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    808791         
    809         cgGLEnableProfile(RenderState::sCgFragmentProfile); 
    810  
    811         cgGLBindProgram(sCgCombinedIllumProgram); 
    812792 
    813793        cgGLSetTextureParameter(sColorsTexCombinedIllumParam, colorsTex); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2879 r2881  
    322322                //cout << "model path: " << model_path << endl; 
    323323 
    324                 cout << "**** end parameters ****" << endl; 
     324                cout << "**** end parameters ****" << endl << endl; 
    325325        } 
    326326 
     
    537537        // this fbo basicly stores the scene information we get from standard rendering of a frame 
    538538        // we store colors, normals, positions (for the ssao) 
    539         fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32); 
     539        fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_24); 
    540540 
    541541        // the diffuse color buffer 
     
    879879                cgGLDisableProfile(RenderState::sCgVertexProfile); 
    880880 
    881                 glDrawBuffers(1, mrt); 
    882  
    883881                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    884882 
     
    901899                glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
    902900 
    903                 glDrawBuffers(1, mrt); 
    904  
    905901                break; 
    906902         
     
    980976        if (renderType == RenderState::DEFERRED)  
    981977        { 
    982                 fbo->Release(); 
     978                FrameBufferObject::Release(); 
    983979 
    984980                cgGLDisableProfile(RenderState::sCgVertexProfile); 
    985981                cgGLDisableProfile(RenderState::sCgFragmentProfile); 
    986  
    987                 glDrawBuffers(1, mrt); 
    988982 
    989983                if (useSsao) 
     
    991985                        if (!ssaoShader) ssaoShader = new SsaoShader(texWidth, texHeight, camera, myfar / 10.0f); 
    992986                        //DEL_PTR(deferredShader); 
    993                          
    994987                        ssaoShader->Render(fbo, oldViewProjMatrix, ssaoExpFactor); 
    995988 
     
    999992                        if (!deferredShader) deferredShader = new DeferredShader(texWidth, texHeight); 
    1000993                        //DEL_PTR(ssaoShader); 
    1001  
    1002994                        deferredShader->Render(fbo); 
    1003995                } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg

    r2880 r2881  
    2929 
    3030 
    31 struct pixel 
     31struct pixel2 
    3232{ 
    3333        float4 ssao_col: COLOR0; 
    3434        float4 illum_col: COLOR1; 
     35}; 
     36 
     37 
     38struct pixel 
     39{ 
     40        float4 illum_col: COLOR0; 
    3541}; 
    3642 
     
    8591                float2 texcoord = IN.texCoord.xy + offsetTransformed * AREA_SIZE * w; 
    8692 
     93                // use lower lod level to improve cache coherence 
    8794                float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, 1)).xyz; 
    8895                float3 sample_color = tex2Dlod(colors, float4(texcoord, 0, 2)).xyz; 
     
    114121/** The mrt shader for screen space ambient occlusion + indirect illumination 
    115122*/ 
    116 pixel main(fragment IN,  
     123pixel2 main(fragment IN,  
    117124                   uniform sampler2D colors, 
    118125                   uniform sampler2D positions, 
     
    128135                   ) 
    129136{ 
    130         pixel OUT; 
     137        pixel2 OUT; 
    131138 
    132139        float4 norm = tex2D(normals, IN.texCoord.xy); 
Note: See TracChangeset for help on using the changeset viewer.