Create the Vertex Buffer Objects used to render the contact point sphere with OpenGL. We create two VBOs (one for vertices and one for indices)
| 198 | // Create the Vertex Buffer Objects used to render the contact point sphere with OpenGL. |
| 199 | /// We create two VBOs (one for vertices and one for indices) |
| 200 | void VisualContactPoint::createVBOAndVAO() { |
| 201 | |
| 202 | // Create the VBO for the vertices data |
| 203 | mVBOVertices.create(); |
| 204 | mVBOVertices.bind(); |
| 205 | size_t sizeVertices = mMesh.getVertices().size() * sizeof(openglframework::Vector3); |
| 206 | mVBOVertices.copyDataIntoVBO(sizeVertices, mMesh.getVerticesPointer(), GL_STATIC_DRAW); |
| 207 | mVBOVertices.unbind(); |
| 208 | |
| 209 | // Create the VBO for the normals data |
| 210 | mVBONormals.create(); |
| 211 | mVBONormals.bind(); |
| 212 | size_t sizeNormals = mMesh.getNormals().size() * sizeof(openglframework::Vector3); |
| 213 | mVBONormals.copyDataIntoVBO(sizeNormals, mMesh.getNormalsPointer(), GL_STATIC_DRAW); |
| 214 | mVBONormals.unbind(); |
| 215 | |
| 216 | // Create th VBO for the indices data |
| 217 | mVBOIndices.create(); |
| 218 | mVBOIndices.bind(); |
| 219 | size_t sizeIndices = mMesh.getIndices(0).size() * sizeof(unsigned int); |
| 220 | mVBOIndices.copyDataIntoVBO(sizeIndices, mMesh.getIndicesPointer(), GL_STATIC_DRAW); |
| 221 | mVBOIndices.unbind(); |
| 222 | |
| 223 | // Create the VAO for both VBOs |
| 224 | mVAO.create(); |
| 225 | mVAO.bind(); |
| 226 | |
| 227 | // Bind the VBO of vertices |
| 228 | mVBOVertices.bind(); |
| 229 | |
| 230 | // Bind the VBO of normals |
| 231 | mVBONormals.bind(); |
| 232 | |
| 233 | // Bind the VBO of indices |
| 234 | mVBOIndices.bind(); |
| 235 | |
| 236 | // Unbind the VAO |
| 237 | mVAO.unbind(); |
| 238 | } |
| 239 | |
| 240 | // Create the Vertex Buffer Objects used to render the contact normal line |
| 241 | void VisualContactPoint::createContactNormalLineVBOAndVAO() { |
nothing calls this directly
no test coverage detected