Ignore:
Timestamp:
08/29/08 15:46:36 (16 years ago)
Author:
mattausch
Message:

found bug with lod levels
made env file for shaders

File:
1 edited

Legend:

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

    r2883 r2884  
    55#include "Vector3.h" 
    66#include "Camera.h" 
     7#include "shaderenv.h" 
    78 
    89 
     
    1314namespace CHCDemoEngine 
    1415{ 
    15  
    16 // number of ssao samples 
    17 #define NUM_SAMPLES 10 
    18  
    1916 
    2017static CGprogram sCgSsaoProgram = NULL; 
     
    4946static CGparameter sNoiseMultiplierParam; 
    5047static CGparameter sExpFactorParam; 
     48 
    5149 
    5250 
     
    137135        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 
    138136 
    139         //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, mWidth, mHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, randomNormals); 
     137        //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, randomNormals); 
    140138        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, w, h, 0, GL_RGB, GL_FLOAT, randomNormals); 
    141139 
     
    183181 
    184182SsaoShader::~SsaoShader()  
    185  
    186183{ 
    187184        if (sCgSsaoProgram)     cgDestroyProgram(sCgSsaoProgram); 
     
    259256                sExpFactorParam = cgGetNamedParameter(sCgSsaoProgram, "expFactor"); 
    260257 
    261                 sSamplesParam = cgGetNamedParameter(sCgSsaoProgram, "samples"); 
    262258                sOldTexParam = cgGetNamedParameter(sCgSsaoProgram, "oldTex");   
    263259                 
     260                cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f)); 
    264261 
    265262                // generate samples for ssao kernel 
    266263                GenerateSamples();  
     264 
     265                sSamplesParam = cgGetNamedParameter(sCgSsaoProgram, "samples"); 
     266                //cgSetArraySize(sSamplesParam, NUM_SAMPLES); 
     267                //cgCompileProgram(sCgSsaoProgram); 
     268                 
    267269                cgGLSetParameterArray2f(sSamplesParam, 0, NUM_SAMPLES, (const float *)samples); 
    268  
    269                 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f)); 
    270270        } 
    271271        else 
     
    415415                CombineIllum(fbo); 
    416416        } 
     417 
    417418        AntiAliasing(fbo); 
    418419 
     
    439440        cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x); 
    440441 
    441 //      GLuint colorsTex = mFbo->GetColorBuffer(0)->GetTexture(); 
    442442        GLuint colorsTex = fbo->GetColorBuffer(3)->GetTexture(); 
    443443        GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 
     
    577577void SsaoShader::AntiAliasing(FrameBufferObject *fbo) 
    578578{ 
    579         //GLuint colorsTex = mNewFbo->GetColorBuffer(1)->GetTexture(); 
    580579        GLuint colorsTex = fbo->GetColorBuffer(0)->GetTexture(); 
    581580        GLuint normalsTex = fbo->GetColorBuffer(2)->GetTexture(); 
     
    727726                cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(3.0f, 17.0f)); 
    728727                cgGLSetParameter1f(sExpFactorGiParam, expFactor); 
    729  
    730728 
    731729                // q: should we generate new samples or only rotate the old ones? 
     
    774772{ 
    775773        GLuint colorsTex = fbo->GetColorBuffer(3)->GetTexture(); 
     774 
    776775        GLuint ssaoTex = mNewFbo->GetColorBuffer(0)->GetTexture(); 
    777776        GLuint illumTex = mNewFbo->GetColorBuffer(1)->GetTexture(); 
    778777 
    779         // 
    780778        fbo->Bind(); 
    781779 
    782         // write into old color texture (not needed anymore) 
     780        // overwrite old color texture 
    783781        glDrawBuffers(1, mymrt); 
    784782 
     
    829827        GLuint ssaoTex = mNewFbo->GetColorBuffer(0)->GetTexture(); 
    830828 
    831         // 
    832829        fbo->Bind(); 
    833830 
Note: See TracChangeset for help on using the changeset viewer.