MCPcopy Index your code
hub / github.com/g3n/engine / RenderSetup

Method RenderSetup

geometry/geometry.go:516–540  ·  view source on GitHub ↗

RenderSetup is called by the renderer before drawing the geometry.

(gs *gls.GLS)

Source from the content-addressed store, hash-verified

514
515// RenderSetup is called by the renderer before drawing the geometry.
516func (g *Geometry) RenderSetup(gs *gls.GLS) {
517
518 // First time initialization
519 if g.gs == nil {
520 // Generate VAO
521 g.handleVAO = gs.GenVertexArray()
522 // Generate buffer for indices
523 g.handleIndices = gs.GenBuffer()
524 // Save pointer to gs indicating initialization was done
525 g.gs = gs
526 }
527
528 // Update VBOs
529 gs.BindVertexArray(g.handleVAO)
530 for _, vbo := range g.vbos {
531 vbo.Transfer(gs)
532 }
533
534 // Update Indices buffer if necessary
535 if g.indices.Size() > 0 && g.updateIndices {
536 gs.BindBuffer(gls.ELEMENT_ARRAY_BUFFER, g.handleIndices)
537 gs.BufferData(gls.ELEMENT_ARRAY_BUFFER, g.indices.Bytes(), g.indices.ToUint32(), gls.STATIC_DRAW)
538 g.updateIndices = false
539 }
540}

Callers

nothing calls this directly

Calls 9

TransferMethod · 0.80
ToUint32Method · 0.80
GenVertexArrayMethod · 0.45
GenBufferMethod · 0.45
BindVertexArrayMethod · 0.45
SizeMethod · 0.45
BindBufferMethod · 0.45
BufferDataMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected