- Timestamp:
- 08/22/08 17:51:54 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 8 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Readme.txt
r2847 r2862 81 81 The project is separated into one section containing supportive code (utils), the traversal algorithms (traversal), and the basic engine classes like Camera, Geometry, Material, or RenderState (rendering). 82 82 83 the tool uses some free 3rd party libraries, like DevIL for the image processing, and glfont2 for the HUD (http://students.cs.byu.edu/~bfish/glfont2.php, many thanks to Brad Fish for fast antialiased text). Also thanks to Alexander Kusternig for providing me his code for the SSAO shader. 83 The tool employs some free 3rd party libraries: 84 85 DevIL for texture loading / unloading 86 glfont2 (http://students.cs.byu.edu/~bfish/glfont2.php) for the antialiased fonts of the HUD. Thanks to the author Brad Fish. 87 The RenderTexture library. Thanks to the author Mark J. Harris. 88 89 Thanks also to Alexander Kusternig for providing me his code for the SSAO shader. 84 90 85 91 If you find any problem with the code or have any comments, please feel free to ask us at any time. -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
r2861 r2862 77 77 glGenTextures(1, &mTexId); 78 78 glBindTexture(GL_TEXTURE_2D, mTexId); 79 //glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, GL_RGBA, glformat, NULL);80 79 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, GL_RGBA, glformat, NULL); 80 81 81 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, color_attachment[attachment_idx], GL_TEXTURE_2D, mTexId, 0); 82 82 … … 118 118 119 119 120 FrameBufferObject::FrameBufferObject(int w, int h, DEPTH_FORMAT d )121 : mWidth(w), mHeight(h) 120 FrameBufferObject::FrameBufferObject(int w, int h, DEPTH_FORMAT d, bool useDepthTex) 121 : mWidth(w), mHeight(h), mDepthTexId(0) 122 122 { 123 123 glGenFramebuffersEXT(1, &mId); 124 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId); 124 125 Bind(); 125 126 126 127 cout << "creating fbo" << endl; … … 152 153 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, depthFormat, mWidth, mHeight); 153 154 glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, mDepthId); 154 } 155 156 if (useDepthTex) 157 { 158 //cout << "adding depth texture" << endl; 159 160 glGenTextures(1, &mDepthTexId); 161 glBindTexture(GL_TEXTURE_2D, mDepthTexId); 162 163 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 164 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 165 166 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 167 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 168 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 169 170 glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, w, h, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); 171 172 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, mDepthTexId, 0); 173 } 174 } 175 176 Release(); 155 177 } 156 178 … … 164 186 cout << "adding color buffer" << endl; 165 187 166 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId);188 Bind(); 167 189 168 190 int idx = (int)mColorBuffers.size(); … … 172 194 mColorBuffers.push_back(colorBuf); 173 195 196 Release(); 197 198 return idx; 199 } 200 201 202 void FrameBufferObject::Bind() const 203 { 204 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId); 205 } 206 207 208 void FrameBufferObject::Release() 209 { 174 210 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 175 176 return idx;177 }178 179 180 void FrameBufferObject::Bind() const181 {182 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mId);183 }184 185 186 void FrameBufferObject::Release()187 {188 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);189 211 } 190 212 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
r2861 r2862 47 47 /** constructor requesting an opengl occlusion query. 48 48 */ 49 FrameBufferObject(int w, int h, DEPTH_FORMAT d );49 FrameBufferObject(int w, int h, DEPTH_FORMAT d, bool useDepthTex = false); 50 50 /** Creates and adds a color buffer to the current frame buffer object. 51 51 Returns the index that allows to retrieve the color buffer object. … … 66 66 */ 67 67 static void Release(); 68 68 69 69 70 protected: … … 76 77 int mHeight; 77 78 int mWidth; 79 80 unsigned int mDepthTexId; 78 81 }; 79 82 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r2861 r2862 69 69 str.read(reinterpret_cast<char *>(&dist), sizeof(float)); 70 70 71 if (i>=3) dist=2e20;71 //if (i>=3) dist=2e20; 72 72 int numShapes; 73 73 str.read(reinterpret_cast<char *>(&numShapes), sizeof(int)); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r2849 r2862 139 139 140 140 #ifdef ATI 141 depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8, RenderTexture::RT_COPY_TO_TEXTURE);141 depthTexture->Initialize(true, true, false, false, false, 32, 32, 32, 32, RenderTexture::RT_COPY_TO_TEXTURE); 142 142 #else 143 depthTexture->Initialize(true, true, false, false, false, 8, 8, 8, 8);//, RenderTexture::RT_COPY_TO_TEXTURE);143 depthTexture->Initialize(true, true, false, false, false, 32, 32, 32, 32); 144 144 #endif 145 145 … … 185 185 186 186 GrabDepthBuffer(mDepth, depthTexture); 187 ExportDepthBuffer(mDepth); 188 PrintGLerror("grab"); 187 //ExportDepthBuffer(mDepth); PrintGLerror("grab"); 189 188 190 189 DEL_PTR(depthTexture);
Note: See TracChangeset
for help on using the changeset viewer.