MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / removeAllInstances

Method removeAllInstances

examples/OpenGLWindow/GLInstancingRenderer.cpp:402–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

400}
401
402void GLInstancingRenderer::removeAllInstances()
403{
404 m_data->m_totalNumInstances = 0;
405
406 for (int i = 0; i < m_graphicsInstances.size(); i++)
407 {
408 if (m_graphicsInstances[i]->m_index_vbo)
409 {
410 glDeleteBuffers(1, &m_graphicsInstances[i]->m_index_vbo);
411 }
412 if (m_graphicsInstances[i]->m_cube_vao)
413 {
414 glDeleteVertexArrays(1, &m_graphicsInstances[i]->m_cube_vao);
415 }
416 delete m_graphicsInstances[i];
417 }
418 m_graphicsInstances.clear();
419 m_data->m_publicGraphicsInstances.exitHandles();
420 m_data->m_publicGraphicsInstances.initHandles();
421
422#if 0
423 //todo: cannot release ALL textures, since some handles are still kept, and it would cause a crash
424 for (int i=0;i<m_data->m_textureHandles.size();i++)
425 {
426 InternalTextureHandle& h = m_data->m_textureHandles[i];
427 glDeleteTextures(1, &h.m_glTexture);
428 }
429 m_data->m_textureHandles.clear();
430#endif
431}
432
433GLInstancingRenderer::~GLInstancingRenderer()
434{

Callers 5

deleteDemoFunction · 0.45
deleteBroadphaseMethod · 0.45
stepSimulationMethod · 0.45
resetAllMethod · 0.45

Calls 4

exitHandlesMethod · 0.80
initHandlesMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected