本文整理匯總了Golang中github.com/banthar/gl.End函數的典型用法代碼示例。如果您正苦於以下問題:Golang End函數的具體用法?Golang End怎麽用?Golang End使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了End函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DrawItemSlot
func (self *Inventory) DrawItemSlot(t int64, r Rect) {
gl.PushMatrix()
gl.LoadIdentity()
gl.Color4ub(16, 16, 16, 255)
gl.Begin(gl.QUADS)
gl.Vertex2d(r.x, r.y)
gl.Vertex2d(r.x+r.sizex, r.y)
gl.Vertex2d(r.x+r.sizex, r.y+r.sizey)
gl.Vertex2d(r.x, r.y+r.sizey)
gl.End()
gl.Color4ub(6, 6, 6, 255)
gl.Begin(gl.LINES)
gl.Vertex2d(r.x, r.y)
gl.Vertex2d(r.x+r.sizex, r.y)
gl.Vertex2d(r.x, r.y)
gl.Vertex2d(r.x, r.y+r.sizey)
gl.End()
gl.Color4ub(64, 64, 64, 255)
gl.Begin(gl.LINES)
gl.Vertex2d(r.x+r.sizex, r.y)
gl.Vertex2d(r.x+r.sizex, r.y+r.sizey)
gl.Vertex2d(r.x, r.y+r.sizey)
gl.Vertex2d(r.x+r.sizex, r.y+r.sizey)
gl.End()
gl.PopMatrix()
}
示例2: drawShip
func drawShip(angle float32) {
gl.PushMatrix()
gl.Translatef(x, y, 0.0)
gl.Rotatef(angle, 0.0, 0.0, 1.0)
if thrust {
gl.Color3f(1.0, 0.0, 0.0)
gl.Begin(gl.LINE_STRIP)
gl.Vertex2f(-0.75, -0.5)
gl.Vertex2f(-1.75, 0)
gl.Vertex2f(-0.75, 0.5)
gl.End()
}
gl.Color3f(1.0, 1.0, 0.0)
gl.Begin(gl.LINE_LOOP)
gl.Vertex2f(2.0, 0.0)
gl.Vertex2f(-1.0, -1.0)
gl.Vertex2f(-0.5, 0.0)
gl.Vertex2f(-1.0, 1.0)
gl.Vertex2f(2.0, 0.0)
gl.End()
if shield {
gl.Color3f(0.1, 0.1, 1.0)
gl.Begin(gl.LINE_LOOP)
for rad := 0.0; rad < 12.0; rad += 1.0 {
gl.Vertex2f(
float32(2.3*math.Cos(2*float64(rad)/math.Pi)+0.2),
float32(2.0*math.Sin(2*float64(rad)/math.Pi)))
}
gl.End()
}
gl.PopMatrix()
}
示例3: Render
func (f frame) Render(w, h, d float64) {
// Draw a wireframe around the arena
gl.Color4ub(255, 255, 255, 31)
gl.LineWidth(2.0)
gl.Begin(gl.LINE_STRIP)
gl.Vertex3d(0, 0, 0)
gl.Vertex3d(w, 0, 0)
gl.Vertex3d(w, h, 0)
gl.Vertex3d(0, h, 0)
gl.Vertex3d(0, 0, 0)
gl.Vertex3d(0, 0, d)
gl.Vertex3d(0, h, d)
gl.Vertex3d(w, h, d)
gl.Vertex3d(w, 0, d)
gl.Vertex3d(0, 0, d)
gl.End()
gl.Begin(gl.LINES)
gl.Vertex3d(0, h, 0)
gl.Vertex3d(0, h, d)
gl.Vertex3d(w, 0, 0)
gl.Vertex3d(w, 0, d)
gl.Vertex3d(w, h, 0)
gl.Vertex3d(w, h, d)
gl.End()
// Render the page.
if f.renderer != nil {
f.renderer.Render(w, h, d)
}
}
示例4: drawScene
func drawScene() {
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
gl.LoadIdentity()
gl.Translatef(-1.5, 0, -6)
gl.Rotatef(trisAngle, 0, 1, 0)
gl.Begin(gl.TRIANGLES)
gl.Color3f(1, 0, 0)
gl.Vertex3f(0, 1, 0)
gl.Color3f(0, 1, 0)
gl.Vertex3f(-1, -1, 0)
gl.Color3f(0, 0, 1)
gl.Vertex3f(1, -1, 0)
gl.End()
gl.LoadIdentity()
gl.Translatef(1.5, 0, -6)
gl.Rotatef(quadAngle, 1, 0, 0)
gl.Color3f(0.5, 0.5, 1.0)
gl.Begin(gl.QUADS)
gl.Vertex3f(-1, 1, 0)
gl.Vertex3f(1, 1, 0)
gl.Vertex3f(1, -1, 0)
gl.Vertex3f(-1, -1, 0)
gl.End()
trisAngle += 0.2
quadAngle -= 0.15
glfw.SwapBuffers()
}
示例5: drawGLScene
// Here goes our drawing code
func drawGLScene() {
// Clear the screen and depth buffer
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
// Move left 1.5 units and into the screen 6.0 units.
gl.LoadIdentity()
gl.Translatef(-1.5, 0.0, -6.0)
gl.Rotatef(float32(rtri), 0.0, 1.0, 0.0) // Rotate the triangle on the Y axis
gl.Begin(gl.TRIANGLES) // Draw triangles
gl.Color3f(1.0, 0.0, 0.0) // Set The Color To Red
gl.Vertex3f(0.0, 1.0, 0.0) // top
gl.Color3f(0.0, 1.0, 0.0) // Set The Color To Red
gl.Vertex3f(-1.0, -1.0, 0.0) // bottom left
gl.Color3f(0.0, 0.0, 1.0) // Set The Color To Red
gl.Vertex3f(1.0, -1.0, 0.0) // bottom right
gl.End() // finish drawing the triangle
// Move right 3 units
gl.LoadIdentity()
gl.Translatef(1.5, 0.0, -6.0)
gl.Color3f(0.5, 0.5, 1.0) // Set The Color To Blue One Time Only
gl.Rotatef(float32(rquad), 1.0, 0.0, 0.0) // rotate the quad on the X axis
gl.Begin(gl.QUADS) // draw quads
gl.Vertex3f(-1.0, 1.0, 0.0) // top left
gl.Vertex3f(1.0, 1.0, 0.0) // top right
gl.Vertex3f(1.0, -1.0, 0.0) // bottom right
gl.Vertex3f(-1.0, -1.0, 0.0) // bottom left
gl.End() // done drawing the quad
// Draw to the screen
sdl.GL_SwapBuffers()
rtri += 0.2 // Increase The Rotation Variable For The Triangle
rquad -= 0.15 // Decrease The Rotation Variable For The Quad
// Gather our frames per second
frames++
t := sdl.GetTicks()
if t-t0 >= 5000 {
seconds := (t - t0) / 1000.0
fps := frames / seconds
fmt.Println(frames, "frames in", seconds, "seconds =", fps, "FPS")
t0 = t
frames = 0
}
}
示例6: Render
func (pp Points) Render() {
gl.Begin(gl.POINTS)
for _, p := range pp {
gl.Vertex2d(p.X, p.Y)
}
gl.End()
}
示例7: DrawLine
func DrawLine(start, end vect.Vect) {
gl.Begin(gl.LINES)
defer gl.End()
gl.Vertex2d(start.X, start.Y)
gl.Vertex2d(end.X, end.Y)
}
示例8: Draw
func (self *Pause) Draw(t int64) {
gl.MatrixMode(gl.MODELVIEW)
gl.PushMatrix()
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.LIGHT0)
gl.Disable(gl.LIGHT1)
gl.Color4ub(0, 0, 0, 240)
gl.Begin(gl.QUADS)
gl.Vertex2f(float32(viewport.lplane), float32(viewport.bplane))
gl.Vertex2f(float32(viewport.rplane), float32(viewport.bplane))
gl.Vertex2f(float32(viewport.rplane), float32(viewport.tplane))
gl.Vertex2f(float32(viewport.lplane), float32(viewport.tplane))
gl.End()
str := "paused"
h, w := pauseFont.Measure(str)
// x := (viewport.rplane - viewport.lplane - w) / 2
// y := (viewport.tplane - viewport.bplane - h) / 2
gl.Translated(-w/2, -h/2, 0)
pauseFont.Print(str)
gl.PopMatrix()
}
示例9: lineTo
func (pen *Pen) lineTo(p Point) {
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.Color4f(0.0, 0.0, 0.0, 0.1)
gl.Begin(gl.LINES)
for _, s := range pen.points {
if s.x == 0 && s.y == 0 {
continue
}
if p.distanceTo(s) < 20.0 {
gl.Vertex2i(int(p.x), int(p.y))
gl.Vertex2i(int(s.x), int(s.y))
}
}
gl.End()
pen.n = (pen.n + 1) % len(pen.points)
pen.points[pen.n] = p
pen.moveTo(p)
}
示例10: Draw
func (s *Sprite) Draw(x, y, angle, scale float32, blend bool) {
gl.Enable(gl.TEXTURE_2D)
gl.Disable(gl.COLOR_MATERIAL)
if blend {
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.BLEND)
} else {
gl.Disable(gl.BLEND)
gl.BlendFunc(gl.ONE, gl.ZERO)
}
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Translatef(x, y, 0)
gl.Rotatef(angle*360/(2*math.Pi), 0, 0, 1)
gl.Scalef(scale, scale, 1)
s.tex.Bind(gl.TEXTURE_2D)
gl.Begin(gl.QUADS)
gl.Color3f(1, 1, 1)
gl.TexCoord2d(0, 0)
gl.Vertex3f(-0.5*s.width, -0.5*s.height, 0)
gl.TexCoord2d(1, 0)
gl.Vertex3f(0.5*s.width, -0.5*s.height, 0)
gl.TexCoord2d(1, 1)
gl.Vertex3f(0.5*s.width, 0.5*s.height, 0)
gl.TexCoord2d(0, 1)
gl.Vertex3f(-0.5*s.width, 0.5*s.height, 0)
gl.End()
gl.Disable(gl.TEXTURE_2D)
gl.Disable(gl.BLEND)
}
示例11: Draw
func (self *Picker) Draw(t int64) {
gl.MatrixMode(gl.MODELVIEW)
gl.PushMatrix()
gl.LoadIdentity()
gl.Disable(gl.DEPTH_TEST)
gl.Disable(gl.LIGHTING)
gl.Disable(gl.LIGHT0)
gl.Disable(gl.LIGHT1)
gl.Begin(gl.TRIANGLE_FAN)
gl.Color4ub(0, 0, 0, 128)
gl.Vertex2f(self.x, self.y)
for angle := float64(0); angle <= 2*math.Pi; angle += math.Pi / 2 / 10 {
gl.Vertex2f(self.x-float32(math.Sin(angle))*self.radius, self.y+float32(math.Cos(angle))*self.radius)
}
gl.End()
self.DrawItemHighlight(t, ThePlayer.currentAction)
self.DrawPlayerItems(t, true)
gl.PopMatrix()
}
示例12: drawCircle
func drawCircle(x, y, r float64) {
//@TODO: Should speed this up by pre-computing all these cos() and sin() calculations and storing in a lookup table.
gl.Begin(gl.TRIANGLE_FAN)
// gl.Color3d(me.red, me.green, me.blue)
gl.Vertex2d(x, y)
pi2 := 2 * math.Pi
num := 36
dTheta := pi2 / float64(num)
theta := float64(0)
for i := 0; i < num; i++ {
theta += dTheta
dx := math.Cos(theta) * r
dy := math.Sin(theta) * r
gl.Vertex2d(x+dx, y+dy)
}
theta += dTheta
dx := math.Cos(theta) * r
dy := math.Sin(theta) * r
gl.Vertex2d(x+dx, y+dy)
gl.End()
}
示例13: lineTo
func (pen *Pen) lineTo(x, y int) {
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.Color4f(0.0, 0.0, 0.0, 0.1)
gl.Begin(gl.LINES)
var p [2]int
for i := range pen.points {
p = pen.points[i]
if p[0] == 0 && p[1] == 0 {
continue
}
if distanceTo(x, y, p[0], p[1]) < 10.0 {
gl.Vertex2i(x, y)
gl.Vertex2i(p[0], p[1])
}
}
gl.End()
pen.n = (pen.n + 1) % len(pen.points)
pen.points[pen.n][0] = x
pen.points[pen.n][1] = y
pen.moveTo(x, y)
}
示例14: drawLine
func drawLine(x1, y1, x2, y2 float64) {
gl.Begin(gl.LINES)
gl.Vertex2d(x1, y1)
gl.Vertex2d(x2, y2)
gl.End()
}
示例15: Render
func (v *Voronoi) Render(w, h, d float64) {
gl.PushMatrix()
gl.Scaled(w, h, 1)
rng := rand.New(rand.NewSource(42))
rng.Seed(42)
// Draw fill colors
for _, wall := range v.cellWalls {
gl.Color3ub(
uint8(100+rng.Int31n(128)),
uint8(100+rng.Int31n(128)),
uint8(100+rng.Int31n(128)))
gl.Begin(gl.TRIANGLE_FAN)
for _, p := range wall {
if p != nil && boundedPoint(p) {
gl.Vertex2d(p.X, p.Y)
}
}
gl.End()
}
// Draw lines
gl.LineWidth(1.5)
gl.Color3ub(0, 128, 0)
gl.Begin(gl.LINES)
for _, edge := range v.edges {
if boundedEdge(edge) {
gl.Vertex2d(edge.Start.X, edge.Start.Y)
gl.Vertex2d(edge.End.X, edge.End.Y)
}
}
gl.End()
// Draw points.
gl.PointSize(2)
gl.Color3ub(255, 255, 255)
gl.Begin(gl.POINTS)
for _, point := range v.points {
gl.Vertex2d(point.X, point.Y)
}
gl.End()
gl.PopMatrix()
}