當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。