本文整理汇总了Golang中github.com/banthar/gl.End函数的典型用法代码示例。如果您正苦于以下问题:Golang End函数的具体用法?Golang End怎么用?Golang End使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了End函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
}
开发者ID:uriel,项目名称:amberfell,代码行数:30,代码来源:inventory.go
示例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()
}
开发者ID:tmc,项目名称:glut,代码行数:32,代码来源:asteroids.go
示例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)
}
}
开发者ID:glenn-brown,项目名称:vu,代码行数:30,代码来源:layout.go
示例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()
}
开发者ID:sycoso,项目名称:glfw,代码行数:33,代码来源:main.go
示例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
}
}
开发者ID:navneet1v,项目名称:opengl-go-tutorials,代码行数:49,代码来源:lesson04.go
示例6: Render
func (pp Points) Render() {
gl.Begin(gl.POINTS)
for _, p := range pp {
gl.Vertex2d(p.X, p.Y)
}
gl.End()
}
开发者ID:glenn-brown,项目名称:vu,代码行数:7,代码来源:points.go
示例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)
}
开发者ID:githubnemo,项目名称:mater,代码行数:7,代码来源:render.go
示例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()
}
开发者ID:codygman,项目名称:amberfell,代码行数:30,代码来源:pause.go
示例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)
}
开发者ID:nkostelnik,项目名称:gl,代码行数:34,代码来源:draw.go
示例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)
}
开发者ID:mfpi,项目名称:lecture-hall-games,代码行数:31,代码来源:utils.go
示例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()
}
开发者ID:codygman,项目名称:amberfell,代码行数:26,代码来源:picker.go
示例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()
}
开发者ID:reiver,项目名称:lifepack,代码行数:32,代码来源:draw.go
示例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)
}
开发者ID:sycoso,项目名称:glfw,代码行数:28,代码来源:main.go
示例14: drawLine
func drawLine(x1, y1, x2, y2 float64) {
gl.Begin(gl.LINES)
gl.Vertex2d(x1, y1)
gl.Vertex2d(x2, y2)
gl.End()
}
开发者ID:reiver,项目名称:lifepack,代码行数:7,代码来源:draw.go
示例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()
}
开发者ID:glenn-brown,项目名称:vu,代码行数:47,代码来源:voronoi.go
示例16: Render
// Render the mesh
// The V array must be a multiple of 3 since it uses triangles to render the mesh.
// If two or more triangles share the same edge the user can pass the same pointer twice
func (m *Mesh) Render() {
count := 0
gl.Begin(gl.TRIANGLES)
for _, v := range m.V {
if count%3 == 0 && count > 0 {
gl.End()
gl.Begin(gl.TRIANGLES)
count = 0
}
gl.Color3f(1, 0, 0)
gl.Vertex3f(v.X, v.Y, v.Z)
count++
}
if count > 0 {
gl.End()
}
}
开发者ID:andrebq,项目名称:tinygl,代码行数:20,代码来源:scene.go
示例17: Draw
func (self *Console) 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)
h := float32(consoleFont.height) * PIXEL_SCALE
margin := float32(3.0) * PIXEL_SCALE
consoleHeight := 3 * h
gl.MatrixMode(gl.MODELVIEW)
gl.LoadIdentity()
gl.Color4ub(0, 0, 0, 208)
gl.Begin(gl.QUADS)
gl.Vertex2f(float32(viewport.lplane), float32(viewport.bplane)+consoleHeight+margin*2) // Bottom Left Of The Texture and Quad
gl.Vertex2f(float32(viewport.rplane), float32(viewport.bplane)+consoleHeight+margin*2) // Bottom Right Of The Texture and Quad
gl.Vertex2f(float32(viewport.rplane), float32(viewport.bplane)) // Top Right Of The Texture and Quad
gl.Vertex2f(float32(viewport.lplane), float32(viewport.bplane)) // Top Left Of The Texture and Quad
gl.End()
gl.Translatef(float32(viewport.lplane)+margin, float32(viewport.bplane)+consoleHeight+margin-h, 0)
consoleFont.Print(fmt.Sprintf("FPS: %5.2f V: %d (%d) CH: %d M: %d", self.fps, self.vertices, self.culledVertices, len(TheWorld.chunks), len(TheWorld.mobs)))
gl.LoadIdentity()
gl.Translatef(float32(viewport.lplane)+margin, float32(viewport.bplane)+consoleHeight+margin-2*h, 0)
consoleFont.Print(fmt.Sprintf("X: %5.2f Y: %4.2f Z: %5.2f H: %5.2f (%s) D: %0.1f (%d)", ThePlayer.position[XAXIS], ThePlayer.position[YAXIS], ThePlayer.position[ZAXIS], ThePlayer.heading, HeadingToCompass(ThePlayer.heading), ThePlayer.distanceTravelled, ThePlayer.distanceFromStart))
gl.LoadIdentity()
gl.Translatef(float32(viewport.lplane)+margin, float32(viewport.bplane)+consoleHeight+margin-3*h, 0)
numgc := uint32(0)
avggc := float64(0)
var last3 [3]float64
if self.mem.NumGC > 3 {
numgc = self.mem.NumGC
avggc = float64(self.mem.PauseTotalNs) / float64(self.mem.NumGC) / 1e6
index := int(numgc) - 1
if index > 255 {
index = 255
}
last3[0] = float64(self.mem.PauseNs[index]) / 1e6
last3[1] = float64(self.mem.PauseNs[index-1]) / 1e6
last3[2] = float64(self.mem.PauseNs[index-2]) / 1e6
}
consoleFont.Print(fmt.Sprintf("Mem: %.1f/%.1f GC: %.1fms [%d: %.1f, %.1f, %.1f] ChGen: %.1fms | Sc: %.1f TOD: %.1f", float64(self.mem.Alloc)/(1024*1024), float64(self.mem.Sys)/(1024*1024), avggc, numgc, last3[0], last3[1], last3[2], float64(self.chunkGenerationTime)/1e6, viewport.scale, timeOfDay))
gl.PopMatrix()
}
开发者ID:caustin,项目名称:amberfell,代码行数:56,代码来源:console.go
示例18: drawOrigin
// Draw unit vectors at the origin.
// The X vector is red, Y is green, and Z is blue.
func drawOrigin() {
gl.Color3ub(0xff, 0, 0)
gl.Begin(gl.LINES)
gl.Vertex3d(0, 0, 0)
gl.Vertex3d(1, 0, 0)
gl.End()
gl.Color3ub(0, 0xff, 0)
gl.Begin(gl.LINES)
gl.Vertex3d(0, 0, 0)
gl.Vertex3d(0, 1, 0)
gl.End()
gl.Color3ub(0, 0, 0xff)
gl.Begin(gl.LINES)
gl.Vertex3d(0, 0, 0)
gl.Vertex3d(0, 0, 1)
gl.End()
}
开发者ID:glenn-brown,项目名称:vu,代码行数:21,代码来源:window.go
示例19: drawBullets
func drawBullets() {
gl.Begin(gl.POINTS)
gl.Color3f(1.0, 0.0, 1.0)
for i := 0; i < MAX_BULLETS; i++ {
if bullet[i].inuse {
gl.Vertex2f(bullet[i].x, bullet[i].y)
}
}
gl.End()
}
开发者ID:tmc,项目名称:glut,代码行数:10,代码来源:asteroids.go
示例20: display
func display() {
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
positionCamera()
gl.Begin(gl.QUADS)
drawTerrain()
gl.End()
gl.Flush()
}
开发者ID:Nightgunner5,项目名称:mmgo,代码行数:11,代码来源:driver.go
注:本文中的github.com/banthar/gl.End函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论