- Timestamp:
- 07/03/08 00:13:43 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r2808 r2809 12 12 using namespace std; 13 13 14 int texWidth = 2048;15 int texHeight = 2048;14 static int texWidth = 2048; 15 static int texHeight = 2048; 16 16 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 }*/30 17 31 18 … … 137 124 cout << "Preparing scene queries" << endl; 138 125 139 RenderTexture *depthTexture = new RenderTexture(texWidth, texHeight, true, true);140 141 #ifdef ATI142 depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8, RenderTexture::RT_COPY_TO_TEXTURE);143 #else144 depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE);145 #endif146 147 PrintGLerror("Init");148 149 150 126 const float xlen = mSceneBox.Size().x * 0.5f; 151 127 const float ylen = mSceneBox.Size().y * 0.5f; … … 160 136 orthoCam->SetPosition(pos); 161 137 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 162 148 depthTexture->BeginCapture(); 149 { 150 glViewport(0, 0, texWidth, texHeight); 163 151 164 glViewport(0, 0, texWidth, texHeight); 152 glClearColor(1, 1, 1, 1); 153 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 165 154 166 glClearColor(1, 1, 1, 1);167 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);155 glFrontFace(GL_CCW); 156 glCullFace(GL_BACK); 168 157 169 glFrontFace(GL_CCW); 170 glCullFace(GL_BACK); 158 glEnable(GL_CULL_FACE); 171 159 172 glDisable(GL_CULL_FACE);173 //glEnable(GL_CULL_FACE);160 glShadeModel(GL_FLAT); 161 glEnable(GL_DEPTH_TEST); 174 162 175 glShadeModel(GL_FLAT);176 glEnable(GL_DEPTH_TEST);163 glMatrixMode(GL_PROJECTION); 164 glLoadIdentity(); 177 165 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); 186 167 187 mDepth = new float[texHeight * texWidth];168 glMatrixMode(GL_MODELVIEW); 188 169 189 //renderer->SetCamera(orthoCam); 190 renderer->RenderScene(); 170 orthoCam->SetupCameraView(); 191 171 172 mDepth = new float[texHeight * texWidth]; 173 174 //renderer->SetCamera(orthoCam); 175 renderer->RenderScene(); 176 } 192 177 depthTexture->EndCapture(); 193 178
Note: See TracChangeset
for help on using the changeset viewer.