本文整理匯總了Golang中github.com/chsc/gogl/gl21.End函數的典型用法代碼示例。如果您正苦於以下問題:Golang End函數的具體用法?Golang End怎麽用?Golang End使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了End函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: RenderOnFloor
func (wp *waypoint) RenderOnFloor() {
if !wp.active {
return
}
wp.drawn = true
gl.Color4ub(200, 0, 0, 128)
base.EnableShader("waypoint")
base.SetUniformF("waypoint", "radius", float32(wp.Radius))
t := float32(time.Now().UnixNano()%1e15) / 1.0e9
base.SetUniformF("waypoint", "time", t)
gl.Begin(gl.QUADS)
gl.TexCoord2i(0, 1)
gl.Vertex2i(int32(wp.X-wp.Radius), int32(wp.Y-wp.Radius))
gl.TexCoord2i(0, 0)
gl.Vertex2i(int32(wp.X-wp.Radius), int32(wp.Y+wp.Radius))
gl.TexCoord2i(1, 0)
gl.Vertex2i(int32(wp.X+wp.Radius), int32(wp.Y+wp.Radius))
gl.TexCoord2i(1, 1)
gl.Vertex2i(int32(wp.X+wp.Radius), int32(wp.Y-wp.Radius))
gl.End()
base.EnableShader("")
// base.EnableShader("")
}
示例2: Draw
func (gw *GameWindow) Draw(region gui.Region, style gui.StyleStack) {
defer base.StackCatcher()
defer func() {
// gl.Translated(gl.Double(gw.region.X), gl.Double(gw.region.Y), 0)
gl.Disable(gl.TEXTURE_2D)
gl.Color4ub(255, 255, 255, 255)
gl.LineWidth(3)
gl.Begin(gl.LINES)
bx, by := gl.Int(region.X), gl.Int(region.Y)
bdx, bdy := gl.Int(region.Dx), gl.Int(region.Dy)
gl.Vertex2i(bx, by)
gl.Vertex2i(bx, by+bdy)
gl.Vertex2i(bx, by+bdy)
gl.Vertex2i(bx+bdx, by+bdy)
gl.Vertex2i(bx+bdx, by+bdy)
gl.Vertex2i(bx+bdx, by)
gl.Vertex2i(bx+bdx, by)
gl.Vertex2i(bx, by)
gl.End()
gl.LineWidth(1)
}()
gw.Engine.Pause()
game := gw.Engine.GetState().(*Game)
game.RenderLocal(region, gw.Local)
gw.Engine.Unpause()
}
示例3: Cylinder
func Cylinder(r, h gl.Float, slices int, hollow, solid bool) {
res := 2 * math.Pi / float64(slices)
mode := gl.LINE_LOOP
if solid {
mode = gl.QUADS
}
gl.Begin(gl.Enum(mode))
for a := 0.0; a < 2*math.Pi; a += res {
gl.Normal3f(gl.Float(math.Cos(a)), gl.Float(math.Sin(a)), 0)
gl.Vertex3f(r*gl.Float(math.Cos(a)), r*gl.Float(math.Sin(a)), 0)
gl.Vertex3f(r*gl.Float(math.Cos(a)), r*gl.Float(math.Sin(a)), h)
a += res
gl.Vertex3f(r*gl.Float(math.Cos(a)), r*gl.Float(math.Sin(a)), h)
gl.Vertex3f(r*gl.Float(math.Cos(a)), r*gl.Float(math.Sin(a)), 0)
}
gl.End()
if !hollow {
// X Y plane
if h < 0 {
gl.Normal3f(0, 0, 1)
} else {
gl.Normal3f(0, 0, -1)
}
Circle(r, slices, solid)
// Top (or bottom)
if h < 0 {
gl.Normal3f(0, 0, -1)
} else {
gl.Normal3f(0, 0, 1)
}
gl.Translatef(0, 0, h)
Circle(r, slices, solid)
}
}
示例4: Draw
func (tsm *ThunderSubMenu) Draw(region Region, style StyleStack) {
gl.Disable(gl.TEXTURE_2D)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.Enable(gl.BLEND)
base.EnableShader("marble")
offset, ok := style.Get("offset").(linear.Vec2)
if ok {
base.SetUniformV2("marble", "offset", offset)
} else {
base.SetUniformV2("marble", "offset", linear.Vec2{})
}
gl.Color4ub(255, 255, 255, 255)
gl.Begin(gl.QUADS)
x := gl.Int(region.X)
y := gl.Int(region.Y)
dx := gl.Int(region.Dx)
dy := gl.Int(region.Dy)
gl.Vertex2i(x, y)
gl.Vertex2i(x, y+dy)
gl.Vertex2i(x+dx, y+dy)
gl.Vertex2i(x+dx, y)
gl.End()
base.EnableShader("")
for i, option := range tsm.Options {
region.Dy = tsm.requests[option].Dy
if i == tsm.selected {
style.PushStyle(map[string]interface{}{"selected": true})
} else {
style.PushStyle(map[string]interface{}{"selected": false})
}
option.Draw(region, style)
style.Pop()
region.Y += tsm.requests[option].Dy
}
}
示例5: 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()
}
}
示例6: Draw
func (gw *GameWindow) Draw(region g2.Region, style g2.StyleStack) {
defer base.StackCatcher()
defer func() {
// gl.Translated(gl.Double(gw.region.X), gl.Double(gw.region.Y), 0)
gl.Disable(gl.TEXTURE_2D)
gl.Color4ub(255, 255, 255, 255)
gl.LineWidth(3)
gl.Begin(gl.LINES)
bx, by := gl.Int(region.X), gl.Int(region.Y)
bdx, bdy := gl.Int(region.Dx), gl.Int(region.Dy)
gl.Vertex2i(bx, by)
gl.Vertex2i(bx, by+bdy)
gl.Vertex2i(bx, by+bdy)
gl.Vertex2i(bx+bdx, by+bdy)
gl.Vertex2i(bx+bdx, by+bdy)
gl.Vertex2i(bx+bdx, by)
gl.Vertex2i(bx+bdx, by)
gl.Vertex2i(bx, by)
gl.End()
gl.LineWidth(1)
}()
gw.Engine.Pause()
game := gw.Engine.GetState().(*Game)
// Note that since we do a READER lock on game.local we cannot do any writes
// to local data while rendering.
game.local.RLock()
game.RenderLocal(region)
game.local.RUnlock()
gw.Engine.Unpause()
}
示例7: renderLosMask
func (g *Game) renderLosMask(local *LocalData) {
ent := g.Ents[local.moba.currentPlayer.gid]
if ent == nil {
return
}
walls := g.temp.VisibleWallCache[GidInvadersStart].GetWalls(int(ent.Pos().X), int(ent.Pos().Y))
gl.Disable(gl.TEXTURE_2D)
gl.Color4ub(0, 0, 0, 255)
gl.Begin(gl.TRIANGLES)
for _, wall := range walls {
if wall.Right(ent.Pos()) {
continue
}
a := wall.P
b := ent.Pos().Sub(wall.P).Norm().Scale(-10000.0).Add(wall.P)
mid := wall.P.Add(wall.Q).Scale(0.5)
c := ent.Pos().Sub(mid).Norm().Scale(-10000.0).Add(mid)
d := ent.Pos().Sub(wall.Q).Norm().Scale(-10000.0).Add(wall.Q)
e := wall.Q
gl.Vertex2d(gl.Double(a.X), gl.Double(a.Y))
gl.Vertex2d(gl.Double(b.X), gl.Double(b.Y))
gl.Vertex2d(gl.Double(c.X), gl.Double(c.Y))
gl.Vertex2d(gl.Double(a.X), gl.Double(a.Y))
gl.Vertex2d(gl.Double(c.X), gl.Double(c.Y))
gl.Vertex2d(gl.Double(d.X), gl.Double(d.Y))
gl.Vertex2d(gl.Double(a.X), gl.Double(a.Y))
gl.Vertex2d(gl.Double(d.X), gl.Double(d.Y))
gl.Vertex2d(gl.Double(e.X), gl.Double(e.Y))
}
gl.End()
base.EnableShader("horizon")
base.SetUniformV2("horizon", "center", ent.Pos())
base.SetUniformF("horizon", "horizon", LosMaxDist)
gl.Begin(gl.QUADS)
dx := gl.Int(g.Levels[GidInvadersStart].Room.Dx)
dy := gl.Int(g.Levels[GidInvadersStart].Room.Dy)
gl.Vertex2i(0, 0)
gl.Vertex2i(dx, 0)
gl.Vertex2i(dx, dy)
gl.Vertex2i(0, dy)
gl.End()
base.EnableShader("")
}
示例8: Draw
func (p *riftWalkProcess) Draw(gid game.Gid, g *game.Game, side int) {
player, ok := g.Ents[p.PlayerGid].(*game.PlayerEnt)
if !ok {
return
}
if side != player.Side() {
return
}
frac := p.Stored.Magnitude() / p.Threshold
if frac < 1 {
gl.Color4ub(255, 0, 0, 255)
} else {
gl.Color4ub(0, 255, 0, 255)
}
base.EnableShader("status_bar")
var outer float32 = 0.2
var increase float32 = 0.01
if frac > 1 {
frac = 1
}
base.SetUniformF("status_bar", "frac", float32(frac))
base.SetUniformF("status_bar", "inner", outer-increase)
base.SetUniformF("status_bar", "outer", outer)
base.SetUniformF("status_bar", "buffer", 0.01)
texture.Render(player.Pos().X-100, player.Pos().Y-100, 200, 200)
base.EnableShader("")
dist, radius := p.GetVals()
dest := player.Pos().Add((linear.Vec2{dist, 0}).Rotate(player.Angle))
gl.Disable(gl.TEXTURE_2D)
gl.Color4d(1, 1, 1, 1)
gl.Begin(gl.LINES)
gl.Vertex2d(gl.Double(player.Pos().X), gl.Double(player.Pos().Y))
gl.Vertex2d(gl.Double(dest.X), gl.Double(dest.Y))
gl.End()
n := 20
gl.Begin(gl.LINES)
for i := 0; i < n; i++ {
v1 := dest.Add((linear.Vec2{radius, 0}).Rotate(float64(i) / float64(n) * 2 * math.Pi))
v2 := dest.Add((linear.Vec2{radius, 0}).Rotate(float64(i+1) / float64(n) * 2 * math.Pi))
gl.Vertex2d(gl.Double(v1.X), gl.Double(v1.Y))
gl.Vertex2d(gl.Double(v2.X), gl.Double(v2.Y))
}
gl.End()
}
示例9: Draw
func (gw *GameWindow) Draw(region gui.Region) {
gw.region = region
latest_region = region
gl.PushMatrix()
defer gl.PopMatrix()
gl.Translated(gl.Double(gw.region.X), gl.Double(gw.region.Y), 0)
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gw.game.manaSource.Draw(gw, float64(gw.game.Dx), float64(gw.game.Dy))
gl.Begin(gl.LINES)
gl.Color4d(1, 1, 1, 1)
for _, poly := range gw.game.Room.Walls {
for i := range poly {
seg := poly.Seg(i)
gl.Vertex2d(gl.Double(seg.P.X), gl.Double(seg.P.Y))
gl.Vertex2d(gl.Double(seg.Q.X), gl.Double(seg.Q.Y))
}
}
gl.End()
gl.Begin(gl.TRIANGLE_FAN)
gl.Color4d(1, 0, 0, 1)
for _, poly := range gw.game.Room.Lava {
for _, v := range poly {
gl.Vertex2d(gl.Double(v.X), gl.Double(v.Y))
}
}
gl.End()
gl.Color4d(1, 1, 1, 1)
for _, ent := range gw.game.Ents {
ent.Draw(gw.game)
}
gl.Disable(gl.TEXTURE_2D)
for _, player := range local.players {
if player.active_ability != nil {
player.active_ability.Draw(player.id, gw.game)
}
}
// base.GetDictionary("luxisr").RenderString("monkeys!!!", 10, 10, 0, float64(gw.game.Game_thinks), gin.Left)
}
示例10: lowerMid
func (s *SegDisplay) lowerMid() {
gl.Begin(gl.POLYGON)
gl.Vertex2d(-s.mW*0.1, -s.mH*0.8)
gl.Vertex2d(+s.mW*0.0, -s.mH*0.9)
gl.Vertex2d(+s.mW*0.1, -s.mH*0.8)
gl.Vertex2d(+s.mW*0.1, -s.mH*0.1)
gl.Vertex2d(+s.mW*0.0, -s.mH*0.0)
gl.Vertex2d(-s.mW*0.1, -s.mH*0.1)
gl.End()
}
示例11: Render
func (sp *SpawnPoint) Render(pos mathgl.Vec2, width float32) {
gl.Disable(gl.TEXTURE_2D)
gl.Color4d(1, 1, 1, 0.1)
gl.Begin(gl.QUADS)
gl.Vertex2f(pos.X-width/2, pos.Y)
gl.Vertex2f(pos.X-width/2, pos.Y+width)
gl.Vertex2f(pos.X+width/2, pos.Y+width)
gl.Vertex2f(pos.X+width/2, pos.Y)
gl.End()
}
示例12: Render
func Render() {
UpdateViewpos()
ClearScene()
gl.Begin(gl.QUADS)
for i := range polys {
polys[i].Render()
}
gl.End()
glfw.SwapBuffers()
}
示例13: top
func (s *SegDisplay) top() {
gl.Begin(gl.POLYGON)
gl.Vertex2d(-s.mW*0.8, +s.mH*0.8)
gl.Vertex2d(-s.mW*0.9, +s.mH*0.9)
gl.Vertex2d(-s.mW*0.8, +s.mH*1.0)
gl.Vertex2d(+s.mW*0.8, +s.mH*1.0)
gl.Vertex2d(+s.mW*0.9, +s.mH*0.9)
gl.Vertex2d(+s.mW*0.8, +s.mH*0.8)
gl.End()
}
示例14: lowerRight
func (s *SegDisplay) lowerRight() {
gl.Begin(gl.POLYGON)
gl.Vertex2d(+s.mW*1.0, -s.mH*0.8)
gl.Vertex2d(+s.mW*0.9, -s.mH*0.9)
gl.Vertex2d(+s.mW*0.8, -s.mH*0.8)
gl.Vertex2d(+s.mW*0.8, -s.mH*0.1)
gl.Vertex2d(+s.mW*0.9, -s.mH*0.0)
gl.Vertex2d(+s.mW*1.0, -s.mH*0.1)
gl.End()
}
示例15: midRight
func (s *SegDisplay) midRight() {
gl.Begin(gl.POLYGON)
gl.Vertex2d(+s.mW*0.1, -s.mH*0.1)
gl.Vertex2d(+s.mW*0.0, +s.mH*0.0)
gl.Vertex2d(+s.mW*0.1, +s.mH*0.1)
gl.Vertex2d(+s.mW*0.8, +s.mH*0.1)
gl.Vertex2d(+s.mW*0.9, +s.mH*0.0)
gl.Vertex2d(+s.mW*0.8, -s.mH*0.1)
gl.End()
}