当前位置: 首页>>代码示例>>Golang>>正文


Golang gl21.Double函数代码示例

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


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

示例1: run

func (w *Window) run() {
	runtime.LockOSThread()
	glfw.MakeContextCurrent(w.w)
	defer glfw.MakeContextCurrent(nil)

	// glfw should fire initial resize events to avoid this duplication (https://github.com/glfw/glfw/issues/62)
	width, height := w.w.Size()
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, gl.Double(width), 0, gl.Double(height), -1, 1)
	Resize(w, Pt(float64(width), float64(height)))
	width, height = w.w.FramebufferSize()
	gl.Viewport(0, 0, gl.Sizei(width), gl.Sizei(height))

	gl.Enable(gl.BLEND)
	gl.Enable(gl.POINT_SMOOTH)
	gl.Enable(gl.LINE_SMOOTH)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)

	for !w.close {
		select {
		case f := <-w.do:
			f()
		case <-w.paint:
			gl.MatrixMode(gl.MODELVIEW)
			gl.LoadIdentity()

			gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
			w.base().paint()
			w.w.SwapBuffers()
		}
	}
}
开发者ID:gordonklaus,项目名称:flux,代码行数:33,代码来源:window.go

示例2: Render

func (vb *VertexBuffer) Render(position Point3) {
	gl.PushMatrix()
	gl.Translated(
		gl.Double(position.X),
		gl.Double(position.Y),
		gl.Double(position.Z))

	gl.VertexPointer(
		gl.Int(3),
		gl.DOUBLE,
		0,
		gl.Pointer(&vb.VertexData[0]))
	gl.ColorPointer(
		gl.Int(4),
		gl.DOUBLE,
		0,
		gl.Pointer(&vb.ColorData[0]))
	gl.TexCoordPointer(
		gl.Int(2),
		gl.DOUBLE,
		0,
		gl.Pointer(&vb.TexCoordData[0]))

	for i := range vb.RenderSteps {
		rs := &vb.RenderSteps[i]
		gl.DrawElements(
			rs.Mode,
			gl.Sizei(len(rs.Indices)),
			gl.UNSIGNED_INT,
			gl.Pointer(&rs.Indices[0]))
	}
	gl.PopMatrix()
}
开发者ID:runningwild,项目名称:arkanoid,代码行数:33,代码来源:gl-geometry.go

示例3: Draw

func (g *Gui) Draw() {
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(gl.Double(g.region.X), gl.Double(g.region.X+g.region.Dx), gl.Double(g.region.Y+g.region.Dy), gl.Double(g.region.Y), 1000, -1000)
	gl.ClearColor(0, 0, 0, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	g.root.Draw(g.region, &styleStack{})
}
开发者ID:runningwild,项目名称:jota,代码行数:10,代码来源:gui.go

示例4: setClipPlanes

func (r Region) setClipPlanes() {
	eqs[0][0], eqs[0][1], eqs[0][2], eqs[0][3] = 1, 0, 0, -gl.Double(r.X)
	eqs[1][0], eqs[1][1], eqs[1][2], eqs[1][3] = -1, 0, 0, gl.Double(r.X+r.Dx)
	eqs[2][0], eqs[2][1], eqs[2][2], eqs[2][3] = 0, 1, 0, -gl.Double(r.Y)
	eqs[3][0], eqs[3][1], eqs[3][2], eqs[3][3] = 0, -1, 0, gl.Double(r.Y+r.Dy)
	gl.ClipPlane(gl.CLIP_PLANE0, &eqs[0][0])
	gl.ClipPlane(gl.CLIP_PLANE1, &eqs[1][0])
	gl.ClipPlane(gl.CLIP_PLANE2, &eqs[2][0])
	gl.ClipPlane(gl.CLIP_PLANE3, &eqs[3][0])
}
开发者ID:dgthunder,项目名称:glop,代码行数:10,代码来源:gui.go

示例5: resized

func (w *Window) resized(width, height int) {
	wid, hei := float64(width), float64(height)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, gl.Double(wid), 0, gl.Double(hei), -1, 1)
	w.Self.Resize(wid, hei)
	if w.centralView != nil {
		w.centralView.Resize(wid, hei)
	}
}
开发者ID:gordonklaus,项目名称:gui,代码行数:10,代码来源:window.go

示例6: InitVertexData

func (vb *VertexBuffer) InitVertexData(
	points []Point3,
	colors []Color,
	texCoords [][2]float64) {
	vb.VertexData = make([]gl.Double, len(points)*3)
	for i := range points {
		vb.VertexData[3*i+0] = gl.Double(points[i].X)
		vb.VertexData[3*i+1] = gl.Double(points[i].Y)
		vb.VertexData[3*i+2] = gl.Double(points[i].Z)
	}

	vb.ColorData = make([]gl.Double, len(colors)*4)
	for i := range colors {
		vb.ColorData[4*i+0] = gl.Double(colors[i].R)
		vb.ColorData[4*i+1] = gl.Double(colors[i].G)
		vb.ColorData[4*i+2] = gl.Double(colors[i].B)
		vb.ColorData[4*i+3] = gl.Double(colors[i].A)
	}

	vb.TexCoordData = make([]gl.Double, len(texCoords)*2)
	for i := range texCoords {
		vb.TexCoordData[2*i+0] = gl.Double(texCoords[i][0])
		vb.TexCoordData[2*i+1] = gl.Double(texCoords[i][1])
	}
}
开发者ID:runningwild,项目名称:arkanoid,代码行数:25,代码来源:gl-geometry.go

示例7: drawScene

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

	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Rotated(-90, 1, 0, 0)
	//gl.Rotated(90, 0, 0, 1)
	gl.Rotated(gl.Double(-viewAngles[2]), 1, 0, 0)
	gl.Rotated(gl.Double(-viewAngles[0]), 0, 1, 0)
	gl.Rotated(gl.Double(-viewAngles[1]), 0, 0, 1)
	gl.Translated(gl.Double(viewOrg[0]), gl.Double(viewOrg[1]), gl.Double(viewOrg[2]))

	var r, g, b gl.Ubyte

	for i, face := range model.Faces {
		r = gl.Ubyte(i) + 100
		g = gl.Ubyte(i>>1) + 100
		b = gl.Ubyte(i>>2) + 100

		if model.Triangle {
			gl.Begin(gl.TRIANGLES)
		} else {
			gl.Begin(gl.LINES)
		}

		gl.Color4ub(r, g, b, 0xff)
		for _, v := range face.Verts {
			gl.Vertex3d(gl.Double(v.Pos[0]), gl.Double(v.Pos[1]), gl.Double(v.Pos[2]))
		}

		gl.End()
	}
}
开发者ID:jayschwa,项目名称:groke,代码行数:33,代码来源:bspview.go

示例8: set2dView

func (o *OpenGl) set2dView() {
	gl.Disable(gl.TEXTURE_2D)
	gl.Disable(gl.DEPTH_TEST)
	gl.Disable(gl.LIGHTING)
	gl.Disable(gl.LIGHT0)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, gl.Double(o.width), 0, gl.Double(o.height), -1, 1)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
}
开发者ID:knickers,项目名称:GOpenGL,代码行数:11,代码来源:GOpenGL.go

示例9: renderPlaceBlock

func (editor *editorData) renderPlaceBlock(g *Game) {
	var expandedPoly linear.Poly
	expandPoly(editor.getPoly(g), &expandedPoly)
	gl.Disable(gl.TEXTURE_2D)
	gl.Color4d(1, 1, 1, 1)
	gl.Begin(gl.TRIANGLE_FAN)
	for _, v := range expandedPoly {
		gl.Vertex2d(gl.Double(v.X), gl.Double(v.Y))
	}
	gl.End()
}
开发者ID:runningwild,项目名称:jota,代码行数:11,代码来源:editor_graphics.go

示例10: paint

func (v *ViewBase) paint() {
	if v.hidden {
		return
	}
	gl.PushMatrix()
	defer gl.PopMatrix()
	d := MapToParent(ZP, v)
	gl.Translated(gl.Double(d.X), gl.Double(d.Y), 0)
	v.Self.Paint()
	for _, child := range v.children {
		child.base().paint()
	}
}
开发者ID:gordonklaus,项目名称:flux,代码行数:13,代码来源:view.go

示例11: Draw

func (g *Gui) Draw() {
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	region := g.root.Render_region
	gl.Ortho(gl.Double(region.X), gl.Double(region.X+region.Dx), gl.Double(region.Y), gl.Double(region.Y+region.Dy), 1000, -1000)
	gl.ClearColor(0, 0, 0, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	g.root.Draw(region)
	if g.FocusWidget() != nil {
		g.FocusWidget().DrawFocused(region)
	}
}
开发者ID:dgthunder,项目名称:glop,代码行数:14,代码来源:gui.go

示例12: Draw

func (f *lightning) Draw(ent game.Ent, g *game.Game) {
	if !f.draw {
		return
	}
	gl.Disable(gl.TEXTURE_2D)
	gl.Color4ub(255, 255, 255, 255)
	forward := (linear.Vec2{1, 0}).Rotate(ent.Angle()).Scale(100000.0)
	gl.Begin(gl.LINES)
	v := ent.Pos().Add(forward)
	gl.Vertex2d(gl.Double(v.X), gl.Double(v.Y))
	v = ent.Pos().Sub(forward)
	gl.Vertex2d(gl.Double(v.X), gl.Double(v.Y))
	gl.End()
}
开发者ID:runningwild,项目名称:jota,代码行数:14,代码来源:ability_graphics.go

示例13: initScene

func initScene(width, height int, init func()) (err error) {
	gl.Disable(gl.DEPTH_TEST)

	gl.ClearColor(0.5, 0.5, 0.5, 0.0)

	gl.Viewport(0, 0, gl.Sizei(width), gl.Sizei(height))
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, gl.Double(width), gl.Double(height), 0, 0, 1)
	gl.MatrixMode(gl.MODELVIEW)

	init()

	return
}
开发者ID:jaredly,项目名称:rocks,代码行数:15,代码来源:draw.go

示例14: OnResize

func (a *app) OnResize(w, h int) {
	oaspect := float64(a.imgW()) / float64(a.imgH())
	haspect := float64(w) / float64(h)
	vaspect := float64(h) / float64(w)
	var scx, scy float64
	if oaspect > haspect {
		scx = 1
		scy = haspect / oaspect
	} else {
		scx = vaspect * oaspect
		scy = 1
	}
	gl.Viewport(0, 0, gl.Sizei(w), gl.Sizei(h))
	gl.LoadIdentity()
	gl.Scaled(gl.Double(scx), gl.Double(scy), 1)
}
开发者ID:jacereda,项目名称:webmplay,代码行数:16,代码来源:webmplay.go

示例15: drawScene

func drawScene() {
	fps()
	gl.Clear(gl.COLOR_BUFFER_BIT)

	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	if input.Zoom > 0 {
		gl.Ortho(0, gl.Double(float64(*flagSize)/input.Zoom), gl.Double(float64(*flagSize)/input.Zoom), 0, -1, 1.0)
	}

	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Translatef(gl.Float(input.TransX*1), gl.Float(input.TransY*1), 0)
	drawGrid()
	drawCells()
}
开发者ID:dskinner,项目名称:cell,代码行数:16,代码来源:main.go


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