Changeset 3294 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Timestamp:
- 01/29/09 18:46:32 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp
r3293 r3294 658 658 { 659 659 glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId); 660 //glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2);660 //glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); 661 661 662 662 // set the vertex pointer to the vertex buffer … … 862 862 state->SetCurrentVboId(mVboId); 863 863 } 864 864 // update bounds of dynamic hierarchy 865 865 glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 866 866 bufferSize * sizeof(Vector3), -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
r3293 r3294 37 37 mHasTexture = (mTexCoords != NULL); 38 38 mHasTangents = (mTangents != NULL); 39 39 /* 40 mIndices = new unsigned int[mNumVertices]; 41 42 for (int i = 0; i < mNumVertices; ++ i) 43 { 44 mIndices[i] = i; 45 }*/ 46 47 // prepare vbos 40 48 Prepare(); 41 49 42 mIndices = new unsigned int[mNumVertices];43 44 for (int i = 0; i < mNumVertices; ++ i)45 {46 mIndices[i] = i;47 }48 49 50 if (delData) 50 51 { 51 52 DEL_ARRAY_PTR(mVertices); 53 DEL_ARRAY_PTR(mIndices); 52 54 DEL_ARRAY_PTR(mNormals); 53 55 DEL_ARRAY_PTR(mTexCoords); … … 65 67 DEL_ARRAY_PTR(mIndices); 66 68 67 // delete vbo 69 // delete vbos 68 70 glDeleteBuffersARB(1, &mVboId); 71 glDeleteBuffersARB(1, &mVboId2); 69 72 } 70 73 … … 144 147 145 148 glBufferDataARB(GL_ARRAY_BUFFER_ARB, dataSize * sizeof(float), 146 (float *)data, GL_STATIC_DRAW_ARB);149 data, GL_STATIC_DRAW_ARB); 147 150 148 151 glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); 149 152 150 glGenBuffersARB(1, &mVboId2); 151 152 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2); 153 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mNumVertices * sizeof(unsigned int), 154 mIndices, GL_STATIC_DRAW_ARB); 155 156 int bufferSize; 157 glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &bufferSize); 158 // cout << "Index Array in VBO: " << bufferSize << " bytes\n"; 159 160 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); 153 154 /////////// 155 //-- the index array 156 157 if (mIndices) 158 { 159 glGenBuffersARB(1, &mVboId2); 160 161 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2); 162 glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mNumVertices * sizeof(unsigned int), 163 mIndices, GL_STATIC_DRAW_ARB); 164 165 int bufferSize; 166 glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &bufferSize); 167 //cout << "Index Array in VBO: " << bufferSize << " bytes\n" << "id: " << mVboId2 << endl; 168 169 glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); 170 } 161 171 162 172 // data handled by graphics driver from now on … … 175 185 { 176 186 glBindBufferARB(GL_ARRAY_BUFFER_ARB, mVboId); 177 //glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2);178 187 179 188 int currentPointer; … … 182 191 if (mHasTangents) 183 192 { 184 //glClientActiveTextureARB(GL_TEXTURE1_ARB);185 //glTexCoordPointer(2, GL_FLOAT, (char *)NULL + mNumVertices * sizeof(Vector3));186 187 193 glColorPointer(3, GL_FLOAT, 0, (char *)NULL + mNumVertices * 2 * sizeof(Vector3)); 188 194 currentPointer = mNumVertices * 3 * sizeof(Vector3); 189 //glClientActiveTextureARB(GL_TEXTURE0_ARB);190 191 195 } 192 196 else … … 201 205 202 206 glVertexPointer(3, GL_FLOAT, 0, (char *)NULL); 207 //glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mVboId2); 208 203 209 /// update state 204 210 state->SetCurrentVboId(mVboId); … … 206 212 207 213 glDrawArrays(GL_TRIANGLES, 0, mNumVertices); 208 //glDrawElements(GL_TRIANGLES, mNumVertices, GL_UNSIGNED_INT, mIndices);209 214 //glDrawElements(GL_TRIANGLES, mNumVertices, GL_UNSIGNED_INT, 0); 210 211 //glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);212 //glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);213 215 214 216 if (mHasTangents) glDisableClientState(GL_COLOR_ARRAY); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3292 r3294 488 488 env.GetFloatParam(string("skyDomeScaleFactor"), skyDomeScaleFactor); 489 489 env.GetIntParam(string("visibilitySolutionInitialState"), visibilitySolutionInitialState); 490 env.GetIntParam(string("renderMode"), renderMode); 490 491 491 492 //env.GetStringParam(string("modelPath"), model_path); … … 527 528 cout << "use skylight for illumination: " << useSkylightForIllum << endl; 528 529 cout << "sky dome scale factor: " << skyDomeScaleFactor << endl; 530 cout << "rendermode: " << renderMode << endl; 529 531 530 532 //cout << "model path: " << model_path << endl; 531 cout << " **** end parameters ****" << endl << endl;533 cout << "==== end parameters ====" << endl << endl; 532 534 } 533 535 … … 617 619 //LoadModel("sibenik.dem", dynamicObjects); 618 620 619 if ( 1) LoadPompeiiFloor();621 if (0) LoadPompeiiFloor(); 620 622 621 623 #if 0 … … 958 960 tr->SetMaxBatchSize(maxBatchSize); 959 961 tr->SetUseMultiQueries(useMultiQueries); 960 tr->SetUseTightBounds( useTightBounds);962 tr->SetUseTightBounds((renderMode == RenderTraverser::CHCPLUSPLUS) && useTightBounds); 961 963 tr->SetUseDepthPass((renderMethod == RENDER_DEPTH_PASS) || (renderMethod == RENDER_DEPTH_PASS_DEFERRED)); 962 964 tr->SetRenderQueue(renderQueue); … … 1331 1333 // ((PvsCollectionRenderer *)traverser)->SetViewCell(usePvs ? viewCell : NULL); 1332 1334 1333 //renderState.LockCullFaceEnabled(true);1334 1335 1335 // actually render the scene geometry using the specified algorithm 1336 1336 traverser->RenderScene(); … … 1641 1641 case 'B': 1642 1642 useTightBounds = !useTightBounds; 1643 traverser->SetUseTightBounds( useTightBounds);1643 traverser->SetUseTightBounds((renderMode == RenderTraverser::CHCPLUSPLUS) && useTightBounds); 1644 1644 break; 1645 1645 case 'v': … … 2332 2332 {"forward", "depth pass + forward", "deferred shading", "depth pass + deferred"}; 2333 2333 sprintf(msg[i ++], "multiqueries: %d, tight bounds: %d, render queue: %d", 2334 useMultiQueries, useTightBounds, useRenderQueue);2334 useMultiQueries, (renderMode == RenderTraverser::CHCPLUSPLUS) && useTightBounds, useRenderQueue); 2335 2335 sprintf(msg[i ++], "render technique: %s, use pvss: %d", renderMethodStr[renderMethod], usePvs); 2336 2336 sprintf(msg[i ++], "triangles per virtual leaf: %5d", trianglesPerVirtualLeaf);
Note: See TracChangeset
for help on using the changeset viewer.