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


Golang gl21.Disable函数代码示例

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


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

示例1: PopClipPlanes

func (r Region) PopClipPlanes() {
	clippers = clippers[0 : len(clippers)-1]
	if len(clippers) == 0 {
		gl.Disable(gl.CLIP_PLANE0)
		gl.Disable(gl.CLIP_PLANE1)
		gl.Disable(gl.CLIP_PLANE2)
		gl.Disable(gl.CLIP_PLANE3)
	} else {
		clippers[len(clippers)-1].setClipPlanes()
	}
}
开发者ID:dgthunder,项目名称:glop,代码行数:11,代码来源:gui.go

示例2: 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

示例3: 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()
}
开发者ID:runningwild,项目名称:jota,代码行数:31,代码来源:game_graphics.go

示例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
	}
}
开发者ID:runningwild,项目名称:magnus,代码行数:35,代码来源:thunder_menu.go

示例5: 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()
}
开发者ID:runningwild,项目名称:magnus,代码行数:27,代码来源:game.go

示例6: Draw

func (ms *ManaSource) Draw(local *LocalData, zoom float64, dx float64, dy float64) {
	if local.nodeTextureData == nil {
		//		gl.Enable(gl.TEXTURE_2D)
		local.nodeTextureData = make([]byte, ms.options.NumNodeRows*ms.options.NumNodeCols*3)
		gl.GenTextures(1, &local.nodeTextureId)
		gl.BindTexture(gl.TEXTURE_2D, local.nodeTextureId)
		gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.MODULATE)
		gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
		gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
		gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT)
		gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT)
		gl.TexImage2D(
			gl.TEXTURE_2D,
			0,
			gl.RGB,
			gl.Sizei(ms.options.NumNodeRows),
			gl.Sizei(ms.options.NumNodeCols),
			0,
			gl.RGB,
			gl.UNSIGNED_BYTE,
			gl.Pointer(&local.nodeTextureData[0]))
	}
	for i := range ms.rawNodes {
		for c := 0; c < 3; c++ {
			color_frac := ms.rawNodes[i].Mana[c] * 1.0 / ms.options.NodeMagnitude
			color_range := float64(ms.options.MaxNodeBrightness - ms.options.MinNodeBrightness)
			local.nodeTextureData[i*3+c] = byte(
				color_frac*color_range + float64(ms.options.MinNodeBrightness))
		}
	}
	gl.Enable(gl.TEXTURE_2D)
	//gl.ActiveTexture(gl.TEXTURE0)
	gl.BindTexture(gl.TEXTURE_2D, local.nodeTextureId)
	gl.TexSubImage2D(
		gl.TEXTURE_2D,
		0,
		0,
		0,
		gl.Sizei(ms.options.NumNodeRows),
		gl.Sizei(ms.options.NumNodeCols),
		gl.RGB,
		gl.UNSIGNED_BYTE,
		gl.Pointer(&local.nodeTextureData[0]))

	base.EnableShader("nodes")
	base.SetUniformI("nodes", "width", ms.options.NumNodeRows*3)
	base.SetUniformI("nodes", "height", ms.options.NumNodeCols*3)
	base.SetUniformI("nodes", "drains", 1)
	base.SetUniformI("nodes", "tex0", 0)
	base.SetUniformI("nodes", "tex1", 1)
	base.SetUniformF("nodes", "zoom", float32(zoom))
	gl.ActiveTexture(gl.TEXTURE0)
	gl.BindTexture(gl.TEXTURE_2D, local.nodeTextureId)

	// I have no idea why this value for move works, but it does.  So, hooray.
	move := (dx - dy) / 2
	texture.RenderAdvanced(move, -move, dy, dx, 3.1415926535/2, true)
	base.EnableShader("")
	gl.Disable(gl.TEXTURE_2D)
}
开发者ID:runningwild,项目名称:magnus,代码行数:60,代码来源:mana_source.go

示例7: getPlayers

func getPlayers(console *base.Console) []gin.DeviceId {
	var ct controllerTracker
	gin.In().RegisterEventListener(&ct)
	defer gin.In().UnregisterEventListener(&ct)
	ticker := time.Tick(time.Millisecond * 17)
	start := time.Time{}
	readyDuration := time.Second * 2
	for start.IsZero() || time.Now().Sub(start) < readyDuration {
		<-ticker
		sys.Think()
		if ct.Ready() && start.IsZero() {
			start = time.Now()
		}
		if !ct.Ready() {
			start = time.Time{}
		}
		render.Queue(func() {
			defer console.Draw(0, 0, wdx, wdy)
			gl.Clear(gl.COLOR_BUFFER_BIT)
			gl.Disable(gl.DEPTH_TEST)
			gui.SetFontColor(1, 1, 1, 1)
			gl.Disable(gl.TEXTURE_2D)
			gl.MatrixMode(gl.PROJECTION)
			gl.LoadIdentity()
			gl.Ortho(gl.Double(0), gl.Double(wdx), gl.Double(wdy), gl.Double(0), 1000, -1000)
			gl.ClearColor(0, 0, 0, 1)
			gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
			gl.MatrixMode(gl.MODELVIEW)
			gl.LoadIdentity()
			base.GetDictionary("crackin").RenderString(fmt.Sprintf("Num players: %d", len(ct.ids)), float64(wdx)/2, 300, 0, 100, gui.Center)
			base.GetDictionary("crackin").RenderString(fmt.Sprintf("Num ready: %d", ct.NumReady()), float64(wdx)/2, 400, 0, 100, gui.Center)
			if !start.IsZero() {
				base.GetDictionary("crackin").RenderString(fmt.Sprintf("Starting in %2.2f", (readyDuration-time.Now().Sub(start)).Seconds()), float64(wdx)/2, 500, 0, 100, gui.Center)
			}
		})
		render.Queue(func() {
			sys.SwapBuffers()
		})
		render.Purge()
	}
	var devices []gin.DeviceId
	for id := range ct.ids {
		devices = append(devices, id)
	}
	return devices
}
开发者ID:runningwild,项目名称:jbot,代码行数:46,代码来源:main.go

示例8: mainLoop

func mainLoop(client sgf.ClientEngine, controllers []gin.DeviceId, console *base.Console) {
	client.MakeRequest(game.Join{Rebels: make([]*game.RebelPlayer, 2)})
	ticker := time.Tick(time.Millisecond * 17)
	render.Queue(func() {
		gl.Enable(gl.BLEND)
		gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	})
	for {
		<-ticker
		if gin.In().GetKey(gin.AnyEscape).FramePressCount() != 0 {
			return
		}
		sys.Think()
		render.Queue(func() {
			gl.Clear(gl.COLOR_BUFFER_BIT)
			gl.Disable(gl.DEPTH_TEST)
			gui.SetFontColor(1, 1, 1, 1)
			gl.Disable(gl.TEXTURE_2D)
			gl.MatrixMode(gl.PROJECTION)
			gl.LoadIdentity()
			gl.Ortho(gl.Double(0), gl.Double(wdx), gl.Double(wdy), gl.Double(0), 1000, -1000)
			gl.ClearColor(0, 0, 0, 1)
			gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
			gl.MatrixMode(gl.MODELVIEW)
			gl.LoadIdentity()
			base.GetDictionary("crackin").RenderString("Waiting on some nubs", float64(wdx)/2, 300, 0, 100, gui.Center)
		})

		client.RLock()
		g := client.Game().(*game.Game)
		mode := g.Mode
		client.RUnlock()
		if mode == game.ModeWaiting {
		} else if mode == game.ModeProgram {
			programLoop(client, controllers, console)
		} else if mode == game.ModeRun {

		}

		render.Queue(func() {
			sys.SwapBuffers()
		})
		render.Purge()
	}
}
开发者ID:runningwild,项目名称:jbot,代码行数:45,代码来源:main.go

示例9: Enable2d

func Enable2d(x1, y1, w, h gl.Double) {

	// Save a copy of the proj matrix so we can restore it
	// when we want to do more 3d rendering
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()

	// Set up orthographic projection
	gl.Ortho(x1, x1+w, y1, y1+h, 0.0, 1)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()

	// Make sure depth testing and lighting are disabled for 2d redering
	// until we are fninished rendering in 2d
	gl.PushAttrib(gl.DEPTH_BUFFER_BIT | gl.LIGHTING_BIT)
	gl.Disable(gl.DEPTH_TEST)
	gl.Disable(gl.LIGHTING)
}
开发者ID:kelly-ry4n,项目名称:glGalaxy,代码行数:18,代码来源:texloader.go

示例10: DrawInfo

func (co *colorOption) DrawInfo(x, y, dx, dy int) {
	gl.Disable(gl.TEXTURE_2D)
	gl.Color4ub(co.r, co.g, co.b, co.a)
	gl.Begin(gl.QUADS)
	gl.Vertex2i(int32(x), int32(y))
	gl.Vertex2i(int32(x), int32(y+dy))
	gl.Vertex2i(int32(x+dx), int32(y+dy))
	gl.Vertex2i(int32(x+dx), int32(y))
	gl.End()
}
开发者ID:ThalwegIII,项目名称:haunts,代码行数:10,代码来源:ui_chooser.go

示例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()
}
开发者ID:RickDakan,项目名称:haunts,代码行数:10,代码来源:spawn.go

示例12: initScene

func initScene() {
	gl.Disable(gl.TEXTURE_2D)
	gl.Disable(gl.DEPTH_TEST)
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.Disable(gl.ALPHA_TEST)
	gl.Enable(gl.LINE_SMOOTH)
	gl.Hint(gl.LINE_SMOOTH_HINT, gl.NICEST)
	gl.PolygonMode(gl.FRONT_AND_BACK, gl.LINE)
	gl.LineWidth(1.0)

	gl.ClearColor(0.0, 0.0, 0.0, 0.0)
	gl.ClearDepth(1)
	//gl.DepthFunc(gl.LEQUAL)

	gl.Viewport(0, 0, Width, Height)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	perspective(110.0, 1.0, 4, 8192)
}
开发者ID:jayschwa,项目名称:groke,代码行数:20,代码来源:bspview.go

示例13: 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

示例14: Text

func Text(x, y, z float32, str string) {
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.Enable(gl.BLEND)

	gl.RasterPos3f(x, y, z)
	for _, ch := range str {
		//glut.BitmapCharacter(glut.BITMAP_9_BY_15, string(ch))
	}

	gl.Disable(gl.BLEND)
}
开发者ID:knickers,项目名称:GOpenGL,代码行数:11,代码来源:text.go

示例15: Number

func Number(x, y, z, n float32) {
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.Enable(gl.BLEND)

	s := ""
	fmt.Fprintf(s, "%f", n)
	gl.RasterPos3f(x, y, z)
	for _, ch := range s {
		//glut.BitmapCharacter(glut.BITMAP_9_BY_15, string(ch))
	}

	gl.Disable(gl.BLEND)
}
开发者ID:knickers,项目名称:GOpenGL,代码行数:13,代码来源:text.go


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