Exemplo n.º 1
0
func NewDynamicShape(bufSize int) *DynamicShape {
	shape := &DynamicShape{}
	shape.VBO = gl.CreateBuffer()
	gl.BindBuffer(gl.ARRAY_BUFFER, shape.VBO)
	gl.BufferInit(gl.ARRAY_BUFFER, bufSize, gl.DYNAMIC_DRAW)

	return shape
}
Exemplo n.º 2
0
func (line *Line) Reset() {
	gl.BindBuffer(gl.ARRAY_BUFFER, line.VBO)
	gl.BufferInit(gl.ARRAY_BUFFER, line.bufSize, gl.DYNAMIC_DRAW)

	line.height = 1.0
	line.step = 3.0 // Per second
	line.angle = 0
	line.angleBuffer = 0
	line.offset = 0
	line.direction = mgl.Vec3{1, 0, 1} // angle=0
	line.position = mgl.Vec3{0, 0, 0}
	line.segments = []mgl.Vec3{line.position}
}
Exemplo n.º 3
0
func ParticleEmitter(origin mgl.Vec3, num int, rate float32) Emitter {
	bufSize := num * particleLen * vecSize
	vbo := gl.CreateBuffer()
	gl.BindBuffer(gl.ARRAY_BUFFER, vbo)
	gl.BufferInit(gl.ARRAY_BUFFER, bufSize, gl.DYNAMIC_DRAW)

	return &particleEmitter{
		VBO:       vbo,
		origin:    origin,
		rate:      rate,
		particles: make([]*particle, 0, num),
		num:       num,
	}
}