Changeset 3327 for GTP


Ignore:
Timestamp:
02/25/09 15:51:45 (15 years ago)
Author:
mattausch
Message:

probably found error with texture

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

Legend:

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

    r3326 r3327  
    165165                } 
    166166        } 
     167} 
     168 
     169 
     170static float *GrabTexture(GLuint tex, int w, int h) 
     171{ 
     172        glBindTexture(GL_TEXTURE_2D, tex); 
     173 
     174        float *data = new float[w * h * 3]; 
     175 
     176        glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT, data); 
     177 
     178        glBindTexture(GL_TEXTURE_2D, 0); 
     179        glDisable(GL_TEXTURE_2D); 
     180 
     181        return data; 
    167182} 
    168183 
     
    772787                tempSamples[i] = samples2[ns]; 
    773788                currentSample = samples2[ns]; 
     789 
    774790                checked[ns] = true; 
    775791        } 
     
    838854                } 
    839855 
     856 
    840857                //if (mSortSamples) { SortSamples(); } 
    841858                //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES); 
    842859                //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_PRECOMPUTED_SAMPLES); 
    843                 sCgSsaoProgram->SetTexture(i, sampleTex2D); 
    844         } 
    845          
     860        } 
     861 
     862        sCgSsaoProgram->SetTexture(i, sampleTex2D); 
     863 
     864        static int dummycount = 0; 
     865 
     866        if (0)//dummycount ++ % 1000 == 0) 
     867        { 
     868                float *data = GrabTexture(sampleTex2D, NUM_PRECOMPUTED_SAMPLES, 1); 
     869                cout << "********************************" << endl; 
     870                for (int i = 0; i < NUM_PRECOMPUTED_SAMPLES; ++ i) 
     871                        cout << data[i] << " "; 
     872                cout << endl; 
     873                delete [] data; 
     874        } 
     875 
    846876        ++ i; 
    847877 
     
    870900        sCgSsaoProgram->SetValue1f(i ++, mSampleIntensity * mKernelRadius); 
    871901 
    872  
    873902        DrawQuad(sCgSsaoProgram); 
    874  
    875903        glPopAttrib(); 
    876904 
     
    905933        // read the second buffer, write to the first buffer 
    906934        if (!displayFrame) 
     935        { 
    907936                FlipFbos(fbo); 
     937        } 
    908938        else 
     939        { 
    909940                // end of the pipeline => just draw image to screen 
    910941                FrameBufferObject::Release(); 
     942        } 
    911943 
    912944        // the neighbouring texels 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp

    r3219 r3327  
    105105 
    106106SceneQuery::SceneQuery(const AxisAlignedBox3 &sceneBox,  
    107                                            RenderTraverser *renderer, RenderState *state):  
    108 mSceneBox(sceneBox), mDepth(NULL), mRenderState(state) 
     107                                           RenderTraverser *renderer,  
     108                                           RenderState *state):  
     109mSceneBox(sceneBox),  
     110mDepth(NULL),  
     111mRenderState(state) 
    109112{ 
    110113        Prepare(renderer); 
     
    118121 
    119122        const float d = mDepth[px + py * texHeight]; 
    120  
    121123        static float depth = d; 
    122124 
     
    147149 
    148150        FrameBufferObject *fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32, true); 
     151 
    149152        fbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE,  
    150153                                ColorBufferObject::WRAP_CLAMP_TO_EDGE,  
     
    177180        orthoCam->SetupViewProjection(); 
    178181 
    179         //glOrtho(xlen, -xlen, ylen, -ylen, 0.0f, mSceneBox.Size().z);  
    180182        glMatrixMode(GL_MODELVIEW); 
    181         //orthoCam->SetupCameraView(); 
    182183 
    183184        mDepth = new float[texHeight * texWidth]; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3326 r3327  
    55//////////// 
    66//-- ssao + gi parameters 
    7 #define NUM_PRECOMPUTED_SAMPLES 4096 
     7#define NUM_PRECOMPUTED_SAMPLES 100 
    88//#define NUM_SAMPLES 8 
    99//#define NUM_SAMPLES 16 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg

    r3326 r3327  
    249249        } 
    250250 
    251         //OUT.illum_col.xyz = float3(col.w * 5e-3f, 0, 0); 
    252         OUT.illum_col.xyz = ao.xyz; 
     251        //OUT.illum_col.xyz = float3(ao.w * 5e-3f, 0, 0); 
     252        //OUT.illum_col.xyz = float3(ao.y * 1e-2f, 0, 0); 
     253        //OUT.illum_col.xyz = ao.xyz; 
    253254 
    254255        OUT.illum_col.w = col.w; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3326 r3327  
    179179                         sampler2D colors, 
    180180                         sampler2D noiseTex, 
     181                         //float2 samples[NUM_PRECOMPUTED_SAMPLES], 
    181182                         sampler2D samples, 
    182183                         float3 normal, 
     
    204205 
    205206                const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + idx) / NUM_PRECOMPUTED_SAMPLES, 0.5f, .0f, .0f)).xy; 
    206  
     207                //const float2 ssaoOffset = samples[i]; 
    207208 
    208209                //////////////////// 
     
    455456                        uniform sampler2D noiseTex, 
    456457                        uniform sampler2D samples, 
     458                        //uniform float2 samples[NUM_PRECOMPUTED_SAMPLES], 
    457459                        uniform sampler2D oldTex, 
    458460                        uniform float4x4 modelViewProj, 
     
    511513 
    512514        const float oldSsao = temporalVals.x; 
    513         float oldWeight = temporalVals.y; 
    514         float oldIdx = temporalVals.z; 
     515        const float oldWeight = temporalVals.y; 
     516        const float oldIdx = 0;//temporalVals.z; 
    515517 
    516518        float3 ao; 
     
    520522        { 
    521523                if (0) 
     524                { 
    522525                        ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject); 
     526                } 
    523527                else 
     528                { 
    524529                        ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor,  
    525530                                   bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity,  
    526531                                           isMovingObject, normals, oldIdx); 
     532                } 
    527533        } 
    528534        else 
     
    574580        OUT.illum_col.w = eyeSpaceDepth; 
    575581 
     582        //if (OUT.illum_col.z > 1000) OUT.illum_col.z = 0; 
     583 
    576584        // this value can be used to check if this pixel belongs to a moving object 
    577585        OUT.col.x = SqrLen(diffVec); 
    578586        //OUT.illum_col.z = SqrLen(diffVec); 
    579587 
    580         OUT.illum_col.xyz = normal.xyz; 
     588        //OUT.illum_col.xyz = normal.xyz; 
    581589        return OUT; 
    582590} 
Note: See TracChangeset for help on using the changeset viewer.