Esempio n. 1
0
func RenderTexturedRect(cam *Camera, m *v.Matrix4, sizeX, sizeY float32, t *Texture) {
	cam.LoadProjection()
	cam.LoadModelview(m)

	gl.Enable(gl.TEXTURE_2D)
	t.tex.Bind(gl.TEXTURE_2D)

	gl.Color4ub(255, 255, 255, 255)
	gl.Begin(gl.QUADS)
	gl.TexCoord2f(0, 1)
	gl.Vertex3f(-sizeX, -sizeY, 0)

	gl.TexCoord2f(1, 1)
	gl.Vertex3f(sizeX, -sizeY, 0)

	gl.TexCoord2f(1, 0)
	gl.Vertex3f(sizeX, sizeY, 0)

	gl.TexCoord2f(0, 0)
	gl.Vertex3f(-sizeX, sizeY, 0)
	gl.End()

	gl.Disable(gl.TEXTURE_2D)
	gl.BindTexture(gl.TEXTURE_2D, 0)
}
Esempio 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)
		}
	}
}
Esempio n. 3
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)
}
Esempio n. 4
0
func Setup() {
	gl.Enable(gl.CULL_FACE)
	gl.Disable(gl.LIGHTING)
	gl.Enable(gl.DEPTH_TEST)
}
Esempio n. 5
0
func RenderUIStart() {
	gl.Disable(gl.DEPTH_TEST)
	gl.DepthMask(false)
}