- Timestamp:
- 08/20/08 13:08:09 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
r2855 r2856 45 45 46 46 ColorBufferObject::ColorBufferObject(int w, int h, 47 COLOR_FORMAT c,48 intwrapType,49 intfilterType,47 FORMAT c, 48 WRAP_TYPE wrapType, 49 FILTER_TYPE filterType, 50 50 bool useMipMap, 51 51 bool useMultiSampling) 52 52 { 53 /* 54 glGenRenderbuffersEXT(1, &normalsBuffer); 55 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, normalsBuffer); 56 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, texWidth, texHeight); 53 glGenRenderbuffersEXT(1, &mId); 54 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mId); 55 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA8, w, h); 57 56 58 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_RENDERBUFFER_EXT, normalsBuffer);57 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_RENDERBUFFER_EXT, mId); 59 58 60 glGenTextures(1, & normalsTex);61 glBindTexture(GL_TEXTURE_2D, normalsTex);62 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texWidth, texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);63 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_TEXTURE_2D, normalsTex, 0);59 glGenTextures(1, &mTexId); 60 glBindTexture(GL_TEXTURE_2D, mTexId); 61 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 62 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_TEXTURE_2D, mTexId, 0); 64 63 65 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 66 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 64 GLuint filterParam; 67 65 68 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 69 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 66 switch (filterType) 67 { 68 case WRAP_NEAREST: 69 filterParam = GL_NEAREST; break; 70 case WRAP_LINEAR: 71 filterParam = GL_LINEAR; break; 72 case WRAP_MIPMAP_LINEAR: 73 filterParam = GL_LINEAR_MIPMAP_LINEAR; break; 74 } 75 76 77 GLuint wrapParam; 78 79 switch (wrapType) 80 { 81 case GL_REPEAT: 82 wrapParam = GL_NEAREST; break; 83 case GL_CLAMP_TO_EDGE: 84 wrapParam = GL_LINEAR; break; 85 } 86 87 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filterParam); 88 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filterParam); 89 90 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapParam); 91 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapParam); 70 92 71 93 PrintFBOStatus(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)); 72 */73 94 } 74 95 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
r2855 r2856 16 16 public: 17 17 18 enum COLOR_FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32 }; 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 21 20 22 ColorBufferObject(int w, int h, 21 COLOR_FORMAT c,22 intwrapType,23 intfilterType,23 FORMAT c, 24 WRAP_TYPE wrapType, 25 FILTER_TYPE filterType, 24 26 bool useMipMap, 25 27 bool useMultiSampling); 28 29 protected: 30 31 unsigned int mId; 32 unsigned int mTexId; 26 33 }; 27 34 … … 40 47 Returns a pointer to the buffer object 41 48 */ 42 ColorBufferObject *AddColorBuffer(ColorBufferObject:: COLOR_FORMAT col,49 ColorBufferObject *AddColorBuffer(ColorBufferObject::FORMAT col, 43 50 int wrapType, 44 51 int filterType, -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/LODInfo.h
r2854 r2856 20 20 public: 21 21 22 LODLevel(float squaredDist): mSquaredDistance(squaredDist) {}22 LODLevel(float squaredDist): mSquaredDistance(squaredDist), mNumTriangles(0) {} 23 23 24 24 inline float GetSquaredDistance() const { return mSquaredDistance; } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2854 r2856 98 98 // eye near plane distance 99 99 float nearDist = 0.2f; 100 /// the field of view 101 float fov = 50.0f; 100 102 /// the pixel threshold where a node is still considered invisible 101 103 int threshold; 102 103 float fov = 50.0f;104 104 105 105 int assumedVisibleFrames = 10; … … 384 384 385 385 if (!useFullScreen) 386 { 386 387 glutCreateWindow("FriendlyCulling"); 388 } 387 389 else 388 390 {
Note: See TracChangeset
for help on using the changeset viewer.