• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang gl.Begin函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/go-gl/gl/v2/1/gl.Begin函数的典型用法代码示例。如果您正苦于以下问题:Golang Begin函数的具体用法?Golang Begin怎么用?Golang Begin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Begin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: drawInnerSlicedBox

func drawInnerSlicedBox(pos, size mgl64.Vec2, borderColor, backgroundColor mgl64.Vec3) {
	if size[0] == 0 || size[1] == 0 {
		return
	}

	const OuterDistance = 2.5
	gl.Begin(gl.POLYGON)
	gl.Color3dv((*float64)(&borderColor[0]))
	gl.Vertex2d(float64(pos[0]+OuterDistance), float64(pos[1]))
	gl.Vertex2d(float64(pos[0]), float64(pos[1]+OuterDistance))
	gl.Vertex2d(float64(pos[0]), float64(pos[1]-OuterDistance+size[1]))
	gl.Vertex2d(float64(pos[0]+OuterDistance), float64(pos[1]+size[1]))
	gl.Vertex2d(float64(pos[0]-OuterDistance+size[0]), float64(pos[1]+size[1]))
	gl.Vertex2d(float64(pos[0]+size[0]), float64(pos[1]-OuterDistance+size[1]))
	gl.Vertex2d(float64(pos[0]+size[0]), float64(pos[1]+OuterDistance))
	gl.Vertex2d(float64(pos[0]-OuterDistance+size[0]), float64(pos[1]))
	gl.End()

	const InnerDistance = OuterDistance + (math.Sqrt2 - 1)
	gl.Begin(gl.POLYGON)
	gl.Color3dv((*float64)(&backgroundColor[0]))
	gl.Vertex2d(float64(pos[0]+InnerDistance), float64(pos[1]+1))
	gl.Vertex2d(float64(pos[0]+1), float64(pos[1]+InnerDistance))
	gl.Vertex2d(float64(pos[0]+1), float64(pos[1]-InnerDistance+size[1]))
	gl.Vertex2d(float64(pos[0]+InnerDistance), float64(pos[1]-1+size[1]))
	gl.Vertex2d(float64(pos[0]-InnerDistance+size[0]), float64(pos[1]-1+size[1]))
	gl.Vertex2d(float64(pos[0]-1+size[0]), float64(pos[1]-InnerDistance+size[1]))
	gl.Vertex2d(float64(pos[0]-1+size[0]), float64(pos[1]+InnerDistance))
	gl.Vertex2d(float64(pos[0]-InnerDistance+size[0]), float64(pos[1]+1))
	gl.End()
}
开发者ID:rexposadas,项目名称:gx,代码行数:31,代码来源:main.go


示例2: drawRoom

func drawRoom(room *Room) {
	h := float64(room.Box.GetAsBox().Height)
	w := float64(room.Box.GetAsBox().Width)
	x1 := float64(0 - w*0.5)
	y1 := float64(0 - h*0.5)
	x2 := float64(0 + w*0.5)
	y2 := float64(0 - h*0.5)
	x3 := float64(0 + w*0.5)
	y3 := float64(0 + h*0.5)
	x4 := float64(0 - w*0.5)
	y4 := float64(0 + h*0.5)

	gl.Begin(gl.POLYGON)
	gl.Color4f(
		room.Color.X(),
		room.Color.Y(),
		room.Color.Z(),
		room.Color.W(),
	)
	gl.Vertex2d(x1, y1)
	gl.Vertex2d(x2, y2)
	gl.Vertex2d(x3, y3)
	gl.Vertex2d(x4, y4)
	gl.End()
	gl.Begin(gl.LINE_LOOP)
	gl.Color4f(.3, .3, 1, .9)
	gl.LineWidth(1.0)
	gl.Vertex2d(x1, y1)
	gl.Vertex2d(x2, y2)
	gl.Vertex2d(x3, y3)
	gl.Vertex2d(x4, y4)
	gl.End()
}
开发者ID:hatajoe,项目名称:go-procedural-dungeon-generation,代码行数:33,代码来源:main.go


示例3: drawScene

func drawScene(w *glfw.Window) {
	width, height := w.GetFramebufferSize()
	ratio := float32(width) / float32(height)
	var x1, x2, y1, y2 float32
	if ratio > 1 {
		x1, x2, y1, y2 = -ratio, ratio, -1, 1
	} else {
		x1, x2, y1, y2 = -1, 1, -1/ratio, 1/ratio
	}

	gl.Viewport(0, 0, int32(width), int32(height))
	gl.Clear(gl.COLOR_BUFFER_BIT)

	// Applies subsequent matrix operations to the projection matrix stack
	gl.MatrixMode(gl.PROJECTION)

	gl.LoadIdentity()                                                   // replace the current matrix with the identity matrix
	gl.Ortho(float64(x1), float64(x2), float64(y1), float64(y2), 1, -1) // multiply the current matrix with an orthographic matrix

	// Applies subsequent matrix operations to the modelview matrix stack
	gl.MatrixMode(gl.MODELVIEW)

	gl.LoadIdentity()

	gl.LineWidth(1)
	gl.Begin(gl.LINE)   // delimit the vertices of a primitive or a group of like primitives
	gl.Color3f(0, 0, 0) // set the current color
	gl.Vertex3f(0, y1, 0)
	gl.Vertex3f(0, y2, 0)
	gl.Vertex3f(x1, 0, 0)
	gl.Vertex3f(x2, 0, 0)
	gl.End()

	gl.Rotatef(float32(glfw.GetTime()*50), 0, 0, 1) // multiply the current matrix by a rotation matrix

	s := float32(.95)

	gl.Begin(gl.TRIANGLES)
	gl.Color3f(1, 0, 0)  // set the current color
	gl.Vertex3f(0, s, 0) // specify a vertex
	gl.Color3f(0, 1, 0)
	gl.Vertex3f(s*.866, s*-0.5, 0)
	gl.Color3f(0, 0, 1)
	gl.Vertex3f(s*-.866, s*-0.5, 0)
	gl.End()

	gl.LineWidth(5)
	gl.Begin(gl.LINE_LOOP)
	for i := float64(0); i < 2*math.Pi; i += .05 {
		r, g, b := hsb2rgb(float32(i/(2*math.Pi)), 1, 1)
		gl.Color3f(r, g, b)
		gl.Vertex3f(s*float32(math.Sin(i)), s*float32(math.Cos(i)), 0)
	}
	gl.End()

}
开发者ID:rdterner,项目名称:gl,代码行数:56,代码来源:demo.go


示例4: drawHud

func (ctx *DrawContext) drawHud(o *orrery.Orrery, frametime time.Duration) {
	txt, size, err := ctx.createHudTexture(o, frametime)
	if err != nil {
		log.Fatalf(`can't create texture from text surface: %s`, err)
	}
	defer gl.DeleteTextures(1, &txt)

	gl.MatrixMode(gl.PROJECTION)
	gl.PushMatrix()
	gl.LoadIdentity()
	gl.Ortho(0.0, float64(ctx.width), float64(ctx.height), 0.0, -1.0, 1.0)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Clear(gl.DEPTH_BUFFER_BIT)

	gl.BindTexture(gl.TEXTURE_2D, txt)
	gl.Enable(gl.TEXTURE_2D)
	defer gl.Disable(gl.TEXTURE_2D)

	gl.Color3f(1, 1, 1)
	gl.Begin(gl.QUADS)
	gl.TexCoord2f(0, 0)
	gl.Vertex2f(0.0, 0.0)
	gl.TexCoord2f(1, 0)
	gl.Vertex2f(float32(size[0]), 0.0)
	gl.TexCoord2f(1, 1)
	gl.Vertex2f(float32(size[0]), float32(size[1]))
	gl.TexCoord2f(0, 1)
	gl.Vertex2f(0.0, float32(size[1]))
	gl.End()

	gl.PopMatrix()
}
开发者ID:farhaven,项目名称:universe,代码行数:33,代码来源:drawing.go


示例5: DrawColoredAtXY

func (img *glImage) DrawColoredAtXY(x, y int, color [4]float32) {
	// TODO have the state knwon globally somewhere so this does not need to be
	// called all the time
	gl.Enable(gl.TEXTURE_2D)
	gl.BindTexture(gl.TEXTURE_2D, img.id)

	gl.Begin(gl.QUADS)

	gl.Color4f(color[0], color[1], color[2], color[3])
	gl.TexCoord2f(img.left, img.top)
	gl.Vertex2i(int32(x), int32(y))

	gl.Color4f(color[0], color[1], color[2], color[3])
	gl.TexCoord2f(img.right, img.top)
	gl.Vertex2i(int32(x+img.Width), int32(y))

	gl.Color4f(color[0], color[1], color[2], color[3])
	gl.TexCoord2f(img.right, img.bottom)
	gl.Vertex2i(int32(x+img.Width), int32(y+img.Height))

	gl.Color4f(color[0], color[1], color[2], color[3])
	gl.TexCoord2f(img.left, img.bottom)
	gl.Vertex2i(int32(x), int32(y+img.Height))

	gl.End()
}
开发者ID:gonutz,项目名称:settlers,代码行数:26,代码来源:gl_image.go


示例6: drawSlide

func drawSlide() {
	gl.Clear(gl.COLOR_BUFFER_BIT)

	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Translatef(0, 0, -3.0)

	gl.Begin(gl.QUADS)

	//top left
	gl.TexCoord2f(0, 0)
	gl.Vertex3f(-1, 1, 0)
	//top right
	gl.TexCoord2f(1, 0)
	gl.Vertex3f(1, 1, 0)

	//bottom right
	gl.TexCoord2f(1, 1)
	gl.Vertex3f(1, -1, 0)

	//bottom left
	gl.TexCoord2f(0, 1)
	gl.Vertex3f(-1, -1, 0)

	gl.End()

}
开发者ID:lordwelch,项目名称:PresentationApp,代码行数:27,代码来源:glfw.go


示例7:

func piirräPisteetSiirrolla(pisteet []vec2.Vector, siirto vec2.Vector) {
	gl.Begin(gl.LINE_STRIP)
	for _, p := range pisteet {
		piirräPiste(p.Plus(siirto))
	}
	gl.End()
}
开发者ID:joonazan,项目名称:go-opas,代码行数:7,代码来源:piirto.go


示例8: MakePolygon

func MakePolygon(points ...Vertex) Polygon {
	gl.Begin(gl.POLYGON)
	for _, p := range points {
		gl.Vertex2i(p.X, p.Y)
	}
	return Polygon{}
}
开发者ID:XO-Lib,项目名称:GCXO,代码行数:7,代码来源:Primitives.go


示例9: draw

// OpenGL draw function
func draw() {
	gl.Clear(gl.COLOR_BUFFER_BIT)
	gl.Enable(gl.BLEND)
	gl.Enable(gl.POINT_SMOOTH)
	gl.Enable(gl.LINE_SMOOTH)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.LoadIdentity()

	gl.Begin(gl.LINES)
	gl.Color3f(.2, .2, .2)
	for i := range staticLines {
		x := staticLines[i].GetAsSegment().A.X
		y := staticLines[i].GetAsSegment().A.Y
		gl.Vertex3f(float32(x), float32(y), 0)
		x = staticLines[i].GetAsSegment().B.X
		y = staticLines[i].GetAsSegment().B.Y
		gl.Vertex3f(float32(x), float32(y), 0)
	}
	gl.End()

	gl.Color4f(.3, .3, 1, .8)
	// draw balls
	for _, ball := range balls {
		gl.PushMatrix()
		pos := ball.Body.Position()
		rot := ball.Body.Angle() * chipmunk.DegreeConst
		gl.Translatef(float32(pos.X), float32(pos.Y), 0.0)
		gl.Rotatef(float32(rot), 0, 0, 1)
		drawCircle(float64(ballRadius), 60)
		gl.PopMatrix()
	}
}
开发者ID:TheZeroSlave,项目名称:chipmunk,代码行数:33,代码来源:bouncing_balls.go


示例10: drawCircle

// drawCircle draws a circle for the specified radius, rotation angle, and the specified number of sides
func drawCircle(radius float64, sides int) {
	gl.Begin(gl.LINE_LOOP)
	for a := 0.0; a < 2*math.Pi; a += (2 * math.Pi / float64(sides)) {
		gl.Vertex2d(math.Sin(a)*radius, math.Cos(a)*radius)
	}
	gl.Vertex3f(0, 0, 0)
	gl.End()
}
开发者ID:jhautefeuille,项目名称:hellochipmunk,代码行数:9,代码来源:main.go


示例11: drawCircle

// drawCircle draws a circle for the specified radius, rotation angle, and the specified number of sides
func drawCircle(radius float64, sides int) {
	gl.Begin(gl.TRIANGLE_FAN)
	for a := 0.0; a < 2*math.Pi; a += (2 * math.Pi / float64(70)) {
		gl.Vertex2d(math.Sin(a)*radius, math.Cos(a)*radius)
	}
	gl.Vertex3f(0, 0, 0)
	gl.End()

}
开发者ID:jhautefeuille,项目名称:hellochipmunk,代码行数:10,代码来源:glfwtest.go


示例12: drawInnerRoundedBox

func drawInnerRoundedBox(pos, size mgl64.Vec2, borderColor, backgroundColor mgl64.Vec3) {
	if size[0] == 0 || size[1] == 0 {
		return
	}

	const totalSlices = 4 * 16
	const borderWidth = 1
	const radius = 2.5 + borderWidth
	var x = float64(totalSlices)

	gl.Color3dv((*float64)(&backgroundColor[0]))
	gl.Begin(gl.TRIANGLE_STRIP)
	for i := 0; i <= totalSlices/4; i++ {
		gl.Vertex2d(pos[0]+size[0]-radius+math.Sin(Tau*float64(i)/x)*(radius-borderWidth), pos[1]+radius-math.Cos(Tau*float64(i)/x)*(radius-borderWidth))
		gl.Vertex2d(pos[0]+radius+math.Sin(Tau*float64(totalSlices-i)/x)*(radius-borderWidth), pos[1]+radius-math.Cos(Tau*float64(totalSlices-i)/x)*(radius-borderWidth))
	}
	for i := totalSlices / 4; i <= totalSlices/2; i++ {
		gl.Vertex2d(pos[0]+size[0]-radius+math.Sin(Tau*float64(i)/x)*(radius-borderWidth), pos[1]+size[1]-radius-math.Cos(Tau*float64(i)/x)*(radius-borderWidth))
		gl.Vertex2d(pos[0]+radius+math.Sin(Tau*float64(totalSlices-i)/x)*(radius-borderWidth), pos[1]+size[1]-radius-math.Cos(Tau*float64(totalSlices-i)/x)*(radius-borderWidth))
	}
	gl.End()

	gl.Color3dv((*float64)(&borderColor[0]))
	gl.Begin(gl.TRIANGLE_STRIP)
	gl.Vertex2d(pos[0]+radius, pos[1])
	gl.Vertex2d(pos[0]+radius, pos[1]+borderWidth)
	for i := 0; i <= totalSlices/4; i++ {
		gl.Vertex2d(pos[0]+size[0]-radius+math.Sin(Tau*float64(i)/x)*radius, pos[1]+radius-math.Cos(Tau*float64(i)/x)*radius)
		gl.Vertex2d(pos[0]+size[0]-radius+math.Sin(Tau*float64(i)/x)*(radius-borderWidth), pos[1]+radius-math.Cos(Tau*float64(i)/x)*(radius-borderWidth))
	}
	for i := totalSlices / 4; i <= totalSlices/2; i++ {
		gl.Vertex2d(pos[0]+size[0]-radius+math.Sin(Tau*float64(i)/x)*radius, pos[1]+size[1]-radius-math.Cos(Tau*float64(i)/x)*radius)
		gl.Vertex2d(pos[0]+size[0]-radius+math.Sin(Tau*float64(i)/x)*(radius-borderWidth), pos[1]+size[1]-radius-math.Cos(Tau*float64(i)/x)*(radius-borderWidth))
	}
	for i := totalSlices / 2; i <= totalSlices*3/4; i++ {
		gl.Vertex2d(pos[0]+radius+math.Sin(Tau*float64(i)/x)*radius, pos[1]+size[1]-radius-math.Cos(Tau*float64(i)/x)*radius)
		gl.Vertex2d(pos[0]+radius+math.Sin(Tau*float64(i)/x)*(radius-borderWidth), pos[1]+size[1]-radius-math.Cos(Tau*float64(i)/x)*(radius-borderWidth))
	}
	for i := totalSlices * 3 / 4; i <= totalSlices; i++ {
		gl.Vertex2d(pos[0]+radius+math.Sin(Tau*float64(i)/x)*radius, pos[1]+radius-math.Cos(Tau*float64(i)/x)*radius)
		gl.Vertex2d(pos[0]+radius+math.Sin(Tau*float64(i)/x)*(radius-borderWidth), pos[1]+radius-math.Cos(Tau*float64(i)/x)*(radius-borderWidth))
	}
	gl.End()
}
开发者ID:rexposadas,项目名称:gx,代码行数:44,代码来源:main.go


示例13: drawSelection

func drawSelection(x, y, p, w float32) {
	gl.LineWidth(w)
	gl.Begin(gl.LINE_STRIP)
	gl.Vertex2f(x-p, y-p)
	gl.Vertex2f(x+256+p, y-p)
	gl.Vertex2f(x+256+p, y+240+p)
	gl.Vertex2f(x-p, y+240+p)
	gl.Vertex2f(x-p, y-p)
	gl.End()
}
开发者ID:sunclx,项目名称:nes,代码行数:10,代码来源:menuview.go


示例14: Render

func (this *Pointer) Render() {
	switch {
	case this.VirtualCategory == POINTING && len(this.State.Axes) >= 2:
		// Prevent pointer from being drawn when the OS mouse pointer is visible.
		{
			// HACK
			var windowSize [2]int
			if globalWindow != nil {
				windowSize[0], windowSize[1] = globalWindow.GetSize()
			}

			// HACK: OS X specific.
			const border = 3
			if this.State.Axes[1] < 0 || this.State.Axes[0] < border || this.State.Axes[0] >= float64(windowSize[0])-border || this.State.Axes[1] >= float64(windowSize[1])-border {
				break
			}
		}

		gl.PushMatrix()
		defer gl.PopMatrix()
		gl.Translated(float64(NearInt64(this.State.Axes[0]))+0.5, float64(NearInt64(this.State.Axes[1]))+0.5, 0)

		const size float64 = 12 * 40 / 40
		gl.Color3d(1, 1, 1)
		gl.Begin(gl.TRIANGLE_FAN)
		gl.Vertex2d(0, 0)
		gl.Vertex2d(0, size)
		gl.Vertex2d(size*0.85*math.Sin(math.Pi/8), size*0.85*math.Cos(math.Pi/8))
		gl.Vertex2d(size/math.Sqrt2, size/math.Sqrt2)
		gl.End()

		gl.Begin(gl.LINE_LOOP)
		gl.Color3d(0, 0, 0)
		gl.Vertex2d(0, 0)
		gl.Vertex2d(0, size)
		gl.Color3d(0.75, 0.75, 0.75)
		gl.Vertex2d(size*0.85*math.Sin(math.Pi/8), size*0.85*math.Cos(math.Pi/8))
		gl.Color3d(0, 0, 0)
		gl.Vertex2d(size/math.Sqrt2, size/math.Sqrt2)
		gl.End()
	}
}
开发者ID:rexposadas,项目名称:gx,代码行数:42,代码来源:main.go


示例15: Fill

func (back *glbackend) Fill(b Bounds) {
	gl.Color4ub(back.current.back.RGBA())
	gl.Begin(gl.QUADS)
	{
		gl.Vertex2f(b.Min.X, b.Min.Y)
		gl.Vertex2f(b.Max.X, b.Min.Y)
		gl.Vertex2f(b.Max.X, b.Max.Y)
		gl.Vertex2f(b.Min.X, b.Max.Y)
	}
	gl.End()
}
开发者ID:egonelbre,项目名称:spector,代码行数:11,代码来源:backend_gl.go


示例16: Stroke

func (back *glbackend) Stroke(b Bounds) {
	gl.Color4ub(back.current.fore.RGBA())
	gl.Begin(gl.LINE_LOOP)
	{
		gl.Vertex2f(b.Min.X, b.Min.Y)
		gl.Vertex2f(b.Max.X, b.Min.Y)
		gl.Vertex2f(b.Max.X, b.Max.Y)
		gl.Vertex2f(b.Min.X, b.Max.Y)
	}
	gl.End()
}
开发者ID:egonelbre,项目名称:spector,代码行数:11,代码来源:backend_gl.go


示例17: draw

func draw() {
	gl.Clear(gl.COLOR_BUFFER_BIT)
	gl.Enable(gl.BLEND)
	gl.Enable(gl.POINT_SMOOTH)
	gl.Enable(gl.LINE_SMOOTH)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.LoadIdentity()

	//Transform screen to keep player in middle. Added intentation to make obvious the push matrix is like a block
	gl.PushMatrix()
	// gl.Translatef((1280/2)-float32(player.x), 0, 0.0)

	// gl.Begin(gl.LINES)
	// gl.Color3f(.2, .5, .2)
	// for i := range staticLines {
	// 	x := staticLines[i].GetAsSegment().A.X
	// 	y := staticLines[i].GetAsSegment().A.Y
	// 	gl.Vertex3f(float32(x), float32(y), 0)
	// 	x = staticLines[i].GetAsSegment().B.X
	// 	y = staticLines[i].GetAsSegment().B.Y
	// 	gl.Vertex3f(float32(x), float32(y), 0)
	// }
	// gl.End()

	gl.Color4f(player.color_r, player.color_g, player.color_b, player.color_a)

	//Draw Player
	gl.PushMatrix()
	rot := player.rot
	pos_x := player.x
	pos_y := player.y

	gl.Translatef(pos_x, pos_y, 0.0)
	gl.Rotatef(float32(rot), 0, 0, 1)
	drawCircle(float64(BALL_RADIUS), 20)
	gl.PopMatrix()

	//Draw the grapple
	gl.PushMatrix()
	gl.Translatef(player.hook.x_end, player.hook.y_end, 0.0)
	drawCircle(float64(5), 5)
	gl.PopMatrix()

	//Grapple Line
	gl.LineWidth(2.5)
	gl.Color3f(1.0, 0.0, 0.0)
	gl.Begin(gl.LINES)
	gl.Vertex3f(player.x, player.y, 0.0)
	gl.Vertex3f(player.hook.x_end, player.hook.y_end, 0)
	gl.End()

	//Second Pop
	gl.PopMatrix()
}
开发者ID:jhautefeuille,项目名称:hellochipmunk,代码行数:54,代码来源:glfwtest.go


示例18: Render

func (e *Element) Render() {

	gl.Color4f(e.color.R, e.color.G, e.color.B, e.color.A)
	gl.Begin(gl.QUADS)

	gl.Vertex3f(e.x, e.y, 0)
	gl.Vertex3f(e.x, e.y+e.height, 0)
	gl.Vertex3f(e.x+e.width, e.y+e.height, 0)
	gl.Vertex3f(e.x+e.width, e.y, 0)

	gl.End()
}
开发者ID:nightowlware,项目名称:gooey,代码行数:12,代码来源:gooey.go


示例19: drawgl

func drawgl() {
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	gl.Begin(gl.TRIANGLES)
	gl.Color3f(1.0, 0.0, 0.0)
	gl.Vertex2f(0.5, 0.0)
	gl.Color3f(0.0, 1.0, 0.0)
	gl.Vertex2f(-0.5, -0.5)
	gl.Color3f(0.0, 0.0, 1.0)
	gl.Vertex2f(-0.5, 0.5)
	gl.End()
}
开发者ID:emlai,项目名称:go-sdl2,代码行数:12,代码来源:opengl.go


示例20: FlushDraw

func (stash *Stash) FlushDraw() {
	i := 0
	texture := stash.ttTextures[i]
	tt := true
	for {
		if texture.nverts > 0 {
			gl.Enable(gl.TEXTURE_2D)
			gl.BindTexture(gl.TEXTURE_2D, texture.id)
			for k := 0; k < texture.nverts; k++ {
				gl.Begin(gl.QUADS)
				gl.Color4fv(&texture.color[0])
				gl.TexCoord2f(texture.verts[k*4+2], texture.verts[k*4+3])
				gl.Vertex2f(texture.verts[k*4+0], texture.verts[k*4+1])
				k++
				gl.Color4fv(&texture.color[0])
				gl.TexCoord2f(texture.verts[k*4+2], texture.verts[k*4+3])
				gl.Vertex2f(texture.verts[k*4+0], texture.verts[k*4+1])
				k++
				gl.Color4fv(&texture.color[0])
				gl.TexCoord2f(texture.verts[k*4+2], texture.verts[k*4+3])
				gl.Vertex2f(texture.verts[k*4+0], texture.verts[k*4+1])
				k++
				gl.Color4fv(&texture.color[0])
				gl.TexCoord2f(texture.verts[k*4+2], texture.verts[k*4+3])
				gl.Vertex2f(texture.verts[k*4+0], texture.verts[k*4+1])
				gl.End()
			}
			gl.Disable(gl.TEXTURE_2D)
			texture.nverts = 0
		}
		if tt {
			if i < len(stash.ttTextures)-1 {
				i++
				texture = stash.ttTextures[i]
			} else {
				i = 0
				if len(stash.bmTextures) > 0 {
					texture = stash.bmTextures[i]
					tt = false
				} else {
					break
				}
			}
		} else {
			if i < len(stash.bmTextures)-1 {
				i++
				texture = stash.bmTextures[i]
			} else {
				break
			}
		}
	}
}
开发者ID:shibukawa,项目名称:fontstash.go,代码行数:53,代码来源:fontstash.go



注:本文中的github.com/go-gl/gl/v2/1/gl.Begin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang gl.BindBuffer函数代码示例发布时间:2022-05-23
下一篇:
Golang gl.Viewport函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap