MCPcopy
hub / github.com/g3n/engine / Dispose

Method Dispose

geometry/geometry.go:496–513  ·  view source on GitHub ↗

Dispose decrements this geometry reference count and if possible releases OpenGL resources, C memory and VBOs associated with this geometry.

()

Source from the content-addressed store, hash-verified

494// if possible releases OpenGL resources, C memory
495// and VBOs associated with this geometry.
496func (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.
516func (g *Geometry) RenderSetup(gs *gls.GLS) {

Callers

nothing calls this directly

Calls 4

InitMethod · 0.95
DisposeMethod · 0.65
DeleteVertexArraysMethod · 0.45
DeleteBuffersMethod · 0.45

Tested by

no test coverage detected