Dispose decrements this geometry reference count and if possible releases OpenGL resources, C memory and VBOs associated with this geometry.
()
| 494 | // if possible releases OpenGL resources, C memory |
| 495 | // and VBOs associated with this geometry. |
| 496 | func (g *Geometry) Dispose() { |
| 497 | |
| 498 | // Only dispose if last |
| 499 | if g.refcount > 1 { |
| 500 | g.refcount-- |
| 501 | return |
| 502 | } |
| 503 | // Delete VAO and indices buffer |
| 504 | if g.gs != nil { |
| 505 | g.gs.DeleteVertexArrays(g.handleVAO) |
| 506 | g.gs.DeleteBuffers(g.handleIndices) |
| 507 | } |
| 508 | // Delete VBOs |
| 509 | for i := 0; i < len(g.vbos); i++ { |
| 510 | g.vbos[i].Dispose() |
| 511 | } |
| 512 | g.Init() |
| 513 | } |
| 514 | |
| 515 | // RenderSetup is called by the renderer before drawing the geometry. |
| 516 | func (g *Geometry) RenderSetup(gs *gls.GLS) { |
nothing calls this directly
no test coverage detected