Changeset 3294 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp
- Timestamp:
- 01/29/09 18:46:32 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note: See TracChangeset
for help on using the changeset viewer.