| 400 | } |
| 401 | |
| 402 | void 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 | |
| 433 | GLInstancingRenderer::~GLInstancingRenderer() |
| 434 | { |
no test coverage detected