Ejemplo n.º 1
0
func RenderSprite(cam *Camera, m *v.Matrix4, sizeX, sizeY float32, t *Texture) {
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.DepthMask(false)
	//gl.Disable(gl.DEPTH_TEST)

	RenderTexturedRect(cam, m, sizeX, sizeY, t)

	gl.Disable(gl.BLEND)
	gl.DepthMask(true)
	//gl.Enable(gl.DEPTH_TEST)
}
Ejemplo n.º 2
0
func (self *SimpleRenderOp) Render(cam *Camera, m *v.Matrix4) {
	cam.LoadProjection()
	cam.LoadModelview(m)

	if self.Blending {
		gl.Enable(gl.BLEND)
		gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
		gl.DepthMask(false)
	}

	if len(self.Textures) > 0 {
		gl.Enable(gl.TEXTURE_2D)
		for i := 0; i < len(self.Textures); i++ {
			self.Textures[i].Bind(i)
		}
	}

	if self.SProgram != nil {
		self.SProgram.Use()
		self.SProgramConf(self.SProgram)
	}

	if self.Buffer.HaveVBO() {
		DrawVBO(self.Buffer)
	} else {
		DrawArray(self.Buffer)
	}

	if self.SProgram != nil {
		self.SProgram.Unuse()
	}

	if self.Blending {
		gl.Disable(gl.BLEND)
		gl.DepthMask(true)
	}

	if len(self.Textures) > 0 {
		gl.Disable(gl.TEXTURE_2D)
		for i := 0; i < len(self.Textures); i++ {
			self.Textures[i].Unbind(i)
		}
	}
}