Exemple #1
0
func drawQuad(srcwidth, destwidth, srcheight, destheight float32) {
	gl.Begin(gl.QUADS)
	gl.TexCoord2i(0, 0)
	gl.Vertex2f(-1, -1)
	gl.TexCoord2i(int(srcwidth), 0)
	gl.Vertex2f(-1+destwidth, -1)
	gl.TexCoord2i(int(srcwidth), int(srcheight))
	gl.Vertex2f(-1+destwidth, -1+destheight)
	gl.TexCoord2i(0, int(srcheight))
	gl.Vertex2f(-1, -1+destheight)
	gl.End()
}
Exemple #2
0
func (t *Texture) PreloadRender() {
	t.Bind()
	gl.Begin(gl.QUADS)
	gl.TexCoord2f(0, 1)
	gl.Vertex3f(0, 0, 1)
	gl.TexCoord2f(1, 1)
	gl.Vertex3f(0, 0, 1)
	gl.TexCoord2f(1, 0)
	gl.Vertex3f(0, 0, 1)
	gl.TexCoord2f(0, 0)
	gl.Vertex3f(0, 0, 1)
	gl.End()
}
Exemple #3
0
func RenderAtlas(a Atlas) {
	a.Bind()
	xratio := float32(a.Width()) / float32(a.Height())
	gl.Begin(gl.QUADS)
	gl.TexCoord2f(0, 1)
	gl.Vertex3f(-0.5, -0.5, 1)
	gl.TexCoord2f(1, 1)
	gl.Vertex3f((xratio)-0.5, -0.5, 1)
	gl.TexCoord2f(1, 0)
	gl.Vertex3f((xratio)-0.5, 0.5, 1)
	gl.TexCoord2f(0, 0)
	gl.Vertex3f(-0.5, 0.5, 1)
	gl.End()
}
Exemple #4
0
func (t *Texture) Render() {
	t.Bind()
	xratio := float32(t.width) / float32(t.height)
	gl.Begin(gl.QUADS)
	gl.TexCoord2f(0, 1)
	gl.Vertex3f(-0.5, -0.5, 1)
	gl.TexCoord2f(1, 1)
	gl.Vertex3f((xratio)-0.5, -0.5, 1)
	gl.TexCoord2f(1, 0)
	gl.Vertex3f((xratio)-0.5, 0.5, 1)
	gl.TexCoord2f(0, 0)
	gl.Vertex3f(-0.5, 0.5, 1)
	gl.End()
}