Changeset 2857 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 08/20/08 16:30:28 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2856 r2857 32 32 #include "Transform3.h" 33 33 #include "SampleGenerator.h" 34 #include "FrameBufferObject.h" 34 35 35 36 … … 201 202 static Matrix4x4 matProjectionView = IdentityMatrix(); 202 203 204 FrameBufferObject *myfbo = NULL; 205 203 206 204 207 // function forward declarations … … 466 469 CreateNoiseTex2D(); 467 470 468 // init render traverser471 // initialize the render traverser 469 472 ResetTraverser(); 470 473 … … 476 479 frameTimer.Start(); 477 480 478 481 // the rendering loop 479 482 glutMainLoop(); 480 483 … … 663 666 void InitFBO() 664 667 { 668 // this fbo basicly stores the scene information we get from standard rendering of a frame 669 // we store colors, normals, positions (for the ssao) 670 myfbo = new FrameBufferObject(texWidth, texHeight, true, FrameBufferObject::DEPTH_24); 671 672 673 ColorBufferObject *diffuseBuffer = 674 myfbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, 675 ColorBufferObject::WRAP_CLAMP_TO_EDGE, 676 ColorBufferObject::FILTER_LINEAR, 677 false, false); 678 679 ColorBufferObject *mypositionBuffer = 680 myfbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, 681 ColorBufferObject::WRAP_CLAMP_TO_EDGE, 682 ColorBufferObject::FILTER_NEAREST, 683 false, false); 684 685 686 ColorBufferObject *mynormalsBuffer = 687 myfbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE, 688 ColorBufferObject::WRAP_CLAMP_TO_EDGE, 689 ColorBufferObject::FILTER_NEAREST, 690 false, false); 691 692 693 694 695 //////////////////////// 696 665 697 glGenFramebuffersEXT(1, &fbo); 666 698 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); … … 673 705 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorsBuffer); 674 706 707 #if 1 675 708 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA32F_ARB, texWidth, texHeight); 676 709 #else 677 710 int samples = 8; 678 //glEnable(GL_MULTISAMPLE_ARB); 679 //glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_RGBA8, texWidth, texHeight); 711 glEnable(GL_MULTISAMPLE_ARB); 712 glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, GL_RGBA8, texWidth, texHeight); 713 #endif 714 680 715 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, colorsBuffer); 681 716 … … 1111 1146 1112 1147 1148 // the main rendering loop 1113 1149 void Display() 1114 1150 { … … 1166 1202 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 1167 1203 1168 state.SetRenderType(RenderState::DEPTH_PASS);1169 glDisable(GL_LIGHTING);1170 1171 1204 cgGLDisableProfile(RenderState::sCgFragmentProfile); 1172 1205 cgGLDisableProfile(RenderState::sCgVertexProfile); 1206 1207 state.SetRenderType(RenderState::DEPTH_PASS); 1208 1209 // the scene is rendered withouth any shading 1210 glDisable(GL_LIGHTING); 1173 1211 1174 1212 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); … … 1219 1257 SetupEyeView(); 1220 1258 1221 1222 /*state.Reset(); 1223 state.SetState(RenderState::RENDER); 1224 1259 // actually render the scene geometry using one of the specified algorithms 1260 traverser->RenderScene(); 1261 1262 1263 1264 ///////// 1265 //-- do the rest of the rendering 1266 1225 1267 glEnableClientState(GL_VERTEX_ARRAY); 1226 1268 glEnableClientState(GL_NORMAL_ARRAY); 1227 1269 1228 for (int i = 0; i < loader->mSceneEntities.size(); ++ i)1229 {1230 SceneEntity *ent = loader->mSceneEntities[i];1231 1232 ent->UpdateLODs(camera);1233 ent->Render(&state);1234 }*/1235 1236 // actually render the scene geometry using one of the specified algorithms1237 traverser->RenderScene();1238 1239 1240 1241 /////////1242 //-- do the rest of the rendering1243 1244 glEnableClientState(GL_VERTEX_ARRAY);1245 glEnableClientState(GL_NORMAL_ARRAY);1246 1247 1270 1248 1271 // reset depth pass and render visible objects … … 1264 1287 glDisableClientState(GL_NORMAL_ARRAY); 1265 1288 1289 1266 1290 if (renderType == RenderState::DEFERRED) 1267 1291 { 1268 glPopAttrib();1292 //glPopAttrib(); 1269 1293 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 1270 1294 … … 1296 1320 } 1297 1321 1298 glFlush();1322 //glFlush(); 1299 1323 1300 1324 const bool restart = true; … … 1303 1327 DisplayStats(); 1304 1328 1329 // flip textures for temporal smoothing 1305 1330 isFirstTexture = !isFirstTexture; 1306 1331
Note: See TracChangeset
for help on using the changeset viewer.