Update VBO with vertices and indices of debug info
| 496 | |
| 497 | // Update VBO with vertices and indices of debug info |
| 498 | void SceneDemo::updateDebugVBO() { |
| 499 | |
| 500 | rp3d::DebugRenderer& debugRenderer = mPhysicsWorld->getDebugRenderer(); |
| 501 | |
| 502 | if (mPhysicsWorld->getIsDebugRenderingEnabled()) { |
| 503 | |
| 504 | // ----- Lines ---- // |
| 505 | |
| 506 | const uint nbLines = debugRenderer.getNbLines(); |
| 507 | |
| 508 | if (nbLines > 0) { |
| 509 | |
| 510 | // Vertices |
| 511 | mDebugVBOLinesVertices.bind(); |
| 512 | GLsizei sizeVertices = static_cast<GLsizei>(nbLines * sizeof(rp3d::DebugRenderer::DebugLine)); |
| 513 | mDebugVBOLinesVertices.copyDataIntoVBO(sizeVertices, debugRenderer.getLinesArray(), GL_STREAM_DRAW); |
| 514 | mDebugVBOLinesVertices.unbind(); |
| 515 | } |
| 516 | |
| 517 | // ----- Triangles ---- // |
| 518 | |
| 519 | const uint nbTriangles = debugRenderer.getNbTriangles(); |
| 520 | |
| 521 | if (nbTriangles > 0) { |
| 522 | |
| 523 | // Vertices |
| 524 | mDebugVBOTrianglesVertices.bind(); |
| 525 | GLsizei sizeVertices = static_cast<GLsizei>(nbTriangles * sizeof(rp3d::DebugRenderer::DebugTriangle)); |
| 526 | mDebugVBOTrianglesVertices.copyDataIntoVBO(sizeVertices, debugRenderer.getTrianglesArray(), GL_STREAM_DRAW); |
| 527 | mDebugVBOTrianglesVertices.unbind(); |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | // Render Debug Infos |
| 533 | void SceneDemo::renderDebugInfos(openglframework::Shader& shader, const openglframework::Matrix4& worldToCameraMatrix) { |
nothing calls this directly
no test coverage detected