- Timestamp:
- 08/20/08 16:30:28 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r2854 r2857 216 216 </File> 217 217 <File 218 RelativePath=".\src\DeferredShader.cpp" 219 > 220 </File> 221 <File 222 RelativePath=".\src\DeferredShader.h" 223 > 224 </File> 225 <File 218 226 RelativePath=".\src\Environment.cpp" 219 227 > … … 221 229 <File 222 230 RelativePath=".\src\Environment.h" 231 > 232 </File> 233 <File 234 RelativePath=".\src\FrameBufferObject.cpp" 235 > 236 </File> 237 <File 238 RelativePath=".\src\FrameBufferObject.h" 223 239 > 224 240 </File> … … 515 531 </File> 516 532 <File 517 RelativePath=".\src\FrameBufferObject.h"518 >519 </File>520 <File521 533 RelativePath=".\src\Geometry.h" 522 534 > … … 618 630 <File 619 631 RelativePath=".\src\chcdemo.cpp" 620 >621 </File>622 <File623 RelativePath=".\src\FrameBufferObject.cpp"624 632 > 625 633 </File> -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
r2856 r2857 66 66 switch (filterType) 67 67 { 68 case WRAP_NEAREST:68 case FILTER_NEAREST: 69 69 filterParam = GL_NEAREST; break; 70 case WRAP_LINEAR:70 case FILTER_LINEAR: 71 71 filterParam = GL_LINEAR; break; 72 case WRAP_MIPMAP_LINEAR:72 case FILTER_MIPMAP_LINEAR: 73 73 filterParam = GL_LINEAR_MIPMAP_LINEAR; break; 74 74 } … … 79 79 switch (wrapType) 80 80 { 81 case GL_REPEAT:82 wrapParam = GL_ NEAREST; break;83 case GL_CLAMP_TO_EDGE:84 wrapParam = GL_ LINEAR; break;81 case WRAP_REPEAT: 82 wrapParam = GL_REPEAT; break; 83 case WRAP_CLAMP_TO_EDGE: 84 wrapParam = GL_CLAMP_TO_EDGE; break; 85 85 } 86 86 … … 91 91 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapParam); 92 92 93 // print status 93 94 PrintFBOStatus(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)); 94 95 } … … 124 125 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, depthFormat, mWidth, mHeight); 125 126 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepthId); 127 } 126 128 127 PrintFBOStatus(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));128 }129 // print status 130 PrintFBOStatus(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)); 129 131 } 130 132 131 133 134 ColorBufferObject *FrameBufferObject::AddColorBuffer(ColorBufferObject::FORMAT col, 135 ColorBufferObject::WRAP_TYPE wrapType, 136 ColorBufferObject::FILTER_TYPE filterType, 137 bool useMipMap, 138 bool useMultiSampling) 139 { 140 ColorBufferObject *colorBuf = 141 new ColorBufferObject(mWidth, mHeight, col, wrapType, filterType, useMipMap, useMultiSampling); 142 mColorBuffers.push_back(colorBuf); 143 144 return colorBuf; 145 } 146 132 147 } // namespace -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
r2856 r2857 17 17 18 18 enum FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32 }; 19 enum FILTER_TYPE { GL_REPEAT, GL_CLAMP_TO_EDGE };20 enum WRAP_TYPE { WRAP_NEAREST, WRAP_LINEAR, WRAP_MIPMAP_LINEAR };19 enum WRAP_TYPE{ WRAP_REPEAT, WRAP_CLAMP_TO_EDGE }; 20 enum FILTER_TYPE { FILTER_NEAREST, FILTER_LINEAR, FILTER_MIPMAP_LINEAR }; 21 21 22 22 ColorBufferObject(int w, int h, … … 48 48 */ 49 49 ColorBufferObject *AddColorBuffer(ColorBufferObject::FORMAT col, 50 intwrapType,51 intfilterType,50 ColorBufferObject::WRAP_TYPE wrapType, 51 ColorBufferObject::FILTER_TYPE filterType, 52 52 bool useMipMap, 53 53 bool useMultiSampling); -
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.