當前位置: 首頁>>代碼示例>>Golang>>正文


Golang gl21.Enable函數代碼示例

本文整理匯總了Golang中github.com/chsc/gogl/gl21.Enable函數的典型用法代碼示例。如果您正苦於以下問題:Golang Enable函數的具體用法?Golang Enable怎麽用?Golang Enable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Enable函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: run

func (w *Window) run(init func(w *Window)) {
	runtime.LockOSThread()
	glfw.MakeContextCurrent(w.w)
	defer glfw.MakeContextCurrent(nil)

	init(w)

	// glfw should fire initial resize events to avoid this duplication (https://github.com/glfw/glfw/issues/62)
	w.resized(w.w.Size())
	w.framebufferResized(w.w.FramebufferSize())

	gl.Enable(gl.SCISSOR_TEST)
	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.Scissor(0, 0, w.bufWidth, w.bufHeight)
			gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
			w.base().paint()
			w.w.SwapBuffers()
		}
	}
}
開發者ID:gordonklaus,項目名稱:gui,代碼行數:32,代碼來源:window.go

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

示例3: PushClipPlanes

func (r Region) PushClipPlanes() {
	if len(clippers) == 0 {
		gl.Enable(gl.CLIP_PLANE0)
		gl.Enable(gl.CLIP_PLANE1)
		gl.Enable(gl.CLIP_PLANE2)
		gl.Enable(gl.CLIP_PLANE3)
		r.setClipPlanes()
		clippers = append(clippers, r)
	} else {
		cur := clippers[len(clippers)-1]
		clippers = append(clippers, r.Isect(cur))
		clippers[len(clippers)-1].setClipPlanes()
	}
}
開發者ID:dgthunder,項目名稱:glop,代碼行數:14,代碼來源:gui.go

示例4: set3dView

func (o *OpenGl) set3dView() {
	gl.Enable(gl.TEXTURE_2D)
	gl.Enable(gl.DEPTH_TEST)
	gl.Enable(gl.LIGHTING)
	gl.Enable(gl.LIGHT0)
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	//gl.Perspective(cam.Zoom(), o.mW / o.mH, cam.Near(), cam.Far())
	gl.MatrixMode(gl.MODELVIEW)
	//e := o.Camera.EYE()
	//a := o.Camera.AT()
	//u := o.Camera.UP()
	//gl.LookAt(e.X, e.Y, e.Z, a.X, a.Y, a.Z, u.X, u.Y, u.Z)
}
開發者ID:knickers,項目名稱:GOpenGL,代碼行數:14,代碼來源:GOpenGL.go

示例5: Init

func (s *Scene) Init() (err error) {
	runtime.LockOSThread()
	gl.Enable(gl.TEXTURE_2D)
	gl.Enable(gl.DEPTH_TEST)

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

	gl.Viewport(0, 0, Width, Height)

	mm.init()

	return
}
開發者ID:drasich,項目名稱:ridley,代碼行數:15,代碼來源:scene.go

示例6: RenderAdvanced

func RenderAdvanced(x, y, dx, dy, rot float64, flip bool) {
	setupTextureList()
	if textureList == 0 {
		return
	}
	var run, op mathgl.Mat4
	run.Identity()
	op.Translation(float32(x), float32(y), 0)
	run.Multiply(&op)
	op.Translation(float32(dx/2), float32(dy/2), 0)
	run.Multiply(&op)
	op.RotationZ(float32(rot))
	run.Multiply(&op)
	if flip {
		op.Translation(float32(-dx/2), float32(-dy/2), 0)
		run.Multiply(&op)
		op.Scaling(float32(dx), float32(dy), 1)
		run.Multiply(&op)
	} else {
		op.Translation(float32(dx/2), float32(-dy/2), 0)
		run.Multiply(&op)
		op.Scaling(float32(-dx), float32(dy), 1)
		run.Multiply(&op)
	}
	gl.PushMatrix()
	gl.MultMatrixf((*gl.Float)(&run[0]))
	gl.Enable(gl.TEXTURE_2D)
	gl.CallList(textureList)
	gl.PopMatrix()
}
開發者ID:runningwild,項目名稱:jbot,代碼行數:30,代碼來源:manager.go

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

示例8: InitGL

func InitGL(smooth bool, multisample int) {
	core.Fatal(gl.Init())

	gl.Enable(gl.LIGHTING)

	gl.Enable(gl.CULL_FACE)
	gl.CullFace(gl.BACK)

	if multisample != 0 {
		gl.Enable(gl.MULTISAMPLE)
	}

	if smooth {
		gl.ShadeModel(gl.SMOOTH)
	}
}
開發者ID:shenyp09,項目名稱:mx3,代碼行數:16,代碼來源:init.go

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

示例10: initWindow

func initWindow(sys system.System, width int, height int) {
	sys.CreateWindow(10, 10, width, height)
	sys.EnableVSync(false)

	err := gl.Init()
	if err != nil {
		panic(err)
	}

	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.EnableClientState(gl.VERTEX_ARRAY)
	gl.EnableClientState(gl.COLOR_ARRAY)
	gl.Enable(gl.CULL_FACE)
	gl.FrontFace(gl.CW)

	gl.ClearColor(0, 0, 0, 1)
}
開發者ID:runningwild,項目名稱:arkanoid,代碼行數:18,代碼來源:main.go

示例11: glInit

func glInit(width, height int) {
	gl.Init()
	gl.Enable(gl.TEXTURE_2D)
	gl.PixelStorei(gl.UNPACK_ALIGNMENT, 1)
	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, -1, 1)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)

	gl.EnableClientState(gl.VERTEX_ARRAY)
	gl.EnableClientState(gl.COLOR_ARRAY)
	gl.EnableClientState(gl.TEXTURE_COORD_ARRAY)
	gl.VertexPointer(2, gl.FLOAT, 0, gl.Pointer(&vs[0]))
	gl.ColorPointer(3, gl.UNSIGNED_BYTE, 0, gl.Pointer(&cs[0]))
	gl.TexCoordPointer(2, gl.FLOAT, 0, gl.Pointer(&ts[0]))
}
開發者ID:ajhager,項目名稱:rog,代碼行數:20,代碼來源:backend.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: ClearScene

func ClearScene() {
	ambient := []gl.Float{0.7, 0.7, 0.7, 1}
	diffuse := []gl.Float{0.9, 0.9, 0.9, 1}
	lightpos := []gl.Float{0.2, 0.5, 1, 1}
	gl.Lightfv(gl.LIGHT0, gl.AMBIENT, &ambient[0])
	gl.Lightfv(gl.LIGHT0, gl.DIFFUSE, &diffuse[0])
	gl.Lightfv(gl.LIGHT0, gl.POSITION, &lightpos[0])
	gl.Enable(gl.LIGHT0)
	gl.ClearColor(1, 1, 1, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
}
開發者ID:shenyp09,項目名稱:mx3,代碼行數:11,代碼來源:magnetization.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: makeErrorTexture

func makeErrorTexture() {
	gl.Enable(gl.TEXTURE_2D)
	gl.GenTextures(1, (*gl.Uint)(&error_texture))
	gl.BindTexture(gl.TEXTURE_2D, error_texture)
	gl.TexEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.MODULATE)
	gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_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)
	pink := []byte{255, 0, 255, 255}
	gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.BYTE, gl.Pointer(&pink[0]))
}
開發者ID:runningwild,項目名稱:jbot,代碼行數:12,代碼來源:texture_devel.go


注:本文中的github.com/chsc/gogl/gl21.Enable函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。