func (ps *ParticleSystem) Render(Proj mgl.Mat4, View mgl.Mat4, clippingPlane mgl.Vec4) {
	gl.PointSize(64)

	ps.VaoRender1.Bind()

	ps.RenderProg.Use()
	Loc := ps.RenderLoc

	Loc.Proj.UniformMatrix4f(false, (*[16]float32)(&Proj))
	Loc.View.UniformMatrix4f(false, (*[16]float32)(&View))
	Loc.MaxLifetime.Uniform1f(ps.MaxLifetime)
	Loc.Image.Uniform1i(constants.TextureFireBall)
	Loc.ClippingPlane_ws.Uniform4f(clippingPlane[0], clippingPlane[1], clippingPlane[2], clippingPlane[3])

	gl.DepthMask(false)
	gl.DrawArraysInstanced(gl.TRIANGLE_FAN, 0, 4, ps.NumParticles)
	gl.DepthMask(true)
}
Example #2
0
func initGL() (err error) {
	gl.Init()
	gl.ShadeModel(gl.SMOOTH)
	gl.ClearColor(0, 0, 0, 0)
	gl.ClearDepth(1)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.Hint(gl.PERSPECTIVE_CORRECTION_HINT, gl.NICEST)
	gl.DepthFunc(gl.NEVER)
	gl.Enable(gl.BLEND)
	gl.DepthMask(true)

	//loadShader()

	return
}