Ignore:
Timestamp:
07/03/08 00:13:43 (16 years ago)
Author:
mattausch
Message:

working on ssao deferred shading approach (debug version!!)

File:
1 edited

Legend:

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

    r2808 r2809  
    1212using namespace std; 
    1313 
    14 int texWidth = 2048; 
    15 int texHeight = 2048; 
     14static int texWidth = 2048; 
     15static int texHeight = 2048; 
    1616 
    17 /*static void cgErrorCallback() 
    18 { 
    19         CGerror lastError = cgGetError(); 
    20  
    21         if(lastError) 
    22         { 
    23                 printf("%s\n\n", cgGetErrorString(lastError)); 
    24                 printf("%s\n", cgGetLastListing(sCgContext)); 
    25                 printf("Cg error, exiting...\n"); 
    26  
    27                 exit(0); 
    28         } 
    29 }*/ 
    3017 
    3118 
     
    137124        cout << "Preparing scene queries" << endl; 
    138125 
    139         RenderTexture *depthTexture = new RenderTexture(texWidth, texHeight, true, true); 
    140  
    141 #ifdef ATI 
    142         depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8, RenderTexture::RT_COPY_TO_TEXTURE); 
    143 #else 
    144         depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE); 
    145 #endif 
    146  
    147         PrintGLerror("Init"); 
    148  
    149  
    150126        const float xlen = mSceneBox.Size().x * 0.5f; 
    151127        const float ylen = mSceneBox.Size().y * 0.5f; 
     
    160136        orthoCam->SetPosition(pos); 
    161137 
     138        RenderTexture *depthTexture = new RenderTexture(texWidth, texHeight, true, true); 
     139 
     140#ifdef ATI 
     141        depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8, RenderTexture::RT_COPY_TO_TEXTURE); 
     142#else 
     143        depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE); 
     144#endif 
     145 
     146        PrintGLerror("Init"); 
     147 
    162148        depthTexture->BeginCapture(); 
     149        { 
     150                glViewport(0, 0, texWidth, texHeight); 
    163151 
    164         glViewport(0, 0, texWidth, texHeight); 
     152                glClearColor(1, 1, 1, 1); 
     153                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    165154 
    166         glClearColor(1, 1, 1, 1); 
    167         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     155                glFrontFace(GL_CCW); 
     156                glCullFace(GL_BACK); 
    168157 
    169         glFrontFace(GL_CCW); 
    170         glCullFace(GL_BACK); 
     158                glEnable(GL_CULL_FACE); 
    171159 
    172         glDisable(GL_CULL_FACE); 
    173         //glEnable(GL_CULL_FACE); 
     160                glShadeModel(GL_FLAT); 
     161                glEnable(GL_DEPTH_TEST); 
    174162 
    175         glShadeModel(GL_FLAT); 
    176         glEnable(GL_DEPTH_TEST); 
     163                glMatrixMode(GL_PROJECTION); 
     164                glLoadIdentity(); 
    177165 
    178         glMatrixMode(GL_PROJECTION); 
    179         glLoadIdentity(); 
    180          
    181         glOrtho(-xlen, xlen, -ylen, ylen, 0.0f, mSceneBox.Size().z);  
    182          
    183         glMatrixMode(GL_MODELVIEW); 
    184          
    185         orthoCam->SetupCameraView(); 
     166                glOrtho(-xlen, xlen, -ylen, ylen, 0.0f, mSceneBox.Size().z);  
    186167 
    187         mDepth = new float[texHeight * texWidth]; 
     168                glMatrixMode(GL_MODELVIEW); 
    188169 
    189         //renderer->SetCamera(orthoCam); 
    190         renderer->RenderScene(); 
     170                orthoCam->SetupCameraView(); 
    191171 
     172                mDepth = new float[texHeight * texWidth]; 
     173 
     174                //renderer->SetCamera(orthoCam); 
     175                renderer->RenderScene(); 
     176        } 
    192177        depthTexture->EndCapture(); 
    193178 
Note: See TracChangeset for help on using the changeset viewer.