MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / updateDebugVBO

Method updateDebugVBO

testbed/src/SceneDemo.cpp:498–530  ·  view source on GitHub ↗

Update VBO with vertices and indices of debug info

Source from the content-addressed store, hash-verified

496
497// Update VBO with vertices and indices of debug info
498void 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
533void SceneDemo::renderDebugInfos(openglframework::Shader& shader, const openglframework::Matrix4& worldToCameraMatrix) {

Callers

nothing calls this directly

Calls 8

getNbLinesMethod · 0.80
copyDataIntoVBOMethod · 0.80
getLinesArrayMethod · 0.80
getTrianglesArrayMethod · 0.80
bindMethod · 0.45
unbindMethod · 0.45
getNbTrianglesMethod · 0.45

Tested by

no test coverage detected