MCPcopy
hub / github.com/EngoEngine/engo / flush

Method flush

common/render_shaders_blendmap.go:390–406  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

388}
389
390func (s *blendmapShader) flush() {
391 // If we haven't rendered anything yet, no point in flushing.
392 if s.idx == 0 {
393 return
394 }
395 engo.Gl.BufferData(engo.Gl.ARRAY_BUFFER, s.vertices, engo.Gl.STATIC_DRAW)
396 // We only want to draw the indicies up to the number of sprites in the current batch.
397 count := s.idx / 20 * 6
398 engo.Gl.DrawElements(engo.Gl.TRIANGLES, count, engo.Gl.UNSIGNED_SHORT, 0)
399 s.idx = 0
400 // We need to reset the vertex buffer so that when we start drawing again, we don't accidentally use junk data.
401 // The "simpler" way to do this would be to just create a new slice with make(), however that would cause the
402 // previous slice to be marked for garbage collection and we'd prefer to keep the GC activity to a minimum.
403 for i := range s.vertices {
404 s.vertices[i] = 0
405 }
406}
407
408func (s *blendmapShader) updateBuffer(ren *RenderComponent, space *SpaceComponent) {
409 // For backwards compatibility, ren.Buffer is set to the VBO and ren.BufferContent

Callers 2

DrawMethod · 0.95
PostMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected