コード例 #1
0
ファイル: room_viewer.go プロジェクト: genbattle/haunts
func drawPrep() {
	gl.Disable(gl.DEPTH_TEST)
	gl.Disable(gl.TEXTURE_2D)
	gl.PolygonMode(gl.FRONT_AND_BACK, gl.FILL)
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.ClearStencil(0)
	gl.Clear(gl.STENCIL_BUFFER_BIT)
}
コード例 #2
0
ファイル: text_line.go プロジェクト: losinggeneration/glop
func (w *TextLine) coreDraw(region Region) {
	if region.Size() == 0 {
		return
	}
	gl.PolygonMode(gl.FRONT_AND_BACK, gl.FILL)
	gl.Color4d(1.0, 1.0, 1.0, 1.0)
	req := w.Request_dims
	if req.Dx > region.Dx {
		req.Dx = region.Dx
	}
	if req.Dy > region.Dy {
		req.Dy = region.Dy
	}
	if req.Dx*region.Dy < req.Dy*region.Dx {
		req.Dy = (region.Dy * req.Dx) / region.Dx
	} else {
		req.Dx = (region.Dx * req.Dy) / region.Dy
	}
	w.Render_region.Dims = req
	w.Render_region.Point = region.Point
	tx := float64(w.rdims.Dx) / float64(w.rgba.Bounds().Dx())
	ty := float64(w.rdims.Dy) / float64(w.rgba.Bounds().Dy())
	//  w.scale = float64(w.Render_region.Dx) / float64(w.rdims.Dx)
	{
		r, g, b, a := w.color.RGBA()
		gl.Color4d(float64(r)/65535, float64(g)/65535, float64(b)/65535, float64(a)/65535)
	}
	gl.Begin(gl.QUADS)
	gl.TexCoord2d(0, 0)
	gl.Vertex2i(region.X, region.Y)
	gl.TexCoord2d(0, -ty)
	gl.Vertex2i(region.X, region.Y+w.rdims.Dy)
	gl.TexCoord2d(tx, -ty)
	gl.Vertex2i(region.X+w.rdims.Dx, region.Y+w.rdims.Dy)
	gl.TexCoord2d(tx, 0)
	gl.Vertex2i(region.X+w.rdims.Dx, region.Y)
	gl.End()
}