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


Golang Context.DeleteProgram方法代码示例

本文整理汇总了Golang中golang.org/x/mobile/gl.Context.DeleteProgram方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.DeleteProgram方法的具体用法?Golang Context.DeleteProgram怎么用?Golang Context.DeleteProgram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在golang.org/x/mobile/gl.Context的用法示例。


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

示例1: LoadShaders

func LoadShaders(glctx gl.Context, program gl.Program, vertexAsset, fragmentAsset string) error {
	vertexShader, err := loadShader(glctx, gl.VERTEX_SHADER, vertexAsset)
	if err != nil {
		return err
	}
	fragmentShader, err := loadShader(glctx, gl.FRAGMENT_SHADER, fragmentAsset)
	if err != nil {
		glctx.DeleteShader(vertexShader)
		return err
	}

	if glctx.GetProgrami(program, gl.ATTACHED_SHADERS) > 0 {
		for _, shader := range glctx.GetAttachedShaders(program) {
			glctx.DetachShader(program, shader)
		}
	}

	glctx.AttachShader(program, vertexShader)
	glctx.AttachShader(program, fragmentShader)
	glctx.LinkProgram(program)

	// Flag shaders for deletion when program is unlinked.
	glctx.DeleteShader(vertexShader)
	glctx.DeleteShader(fragmentShader)

	if glctx.GetProgrami(program, gl.LINK_STATUS) == 0 {
		defer glctx.DeleteProgram(program)
		return fmt.Errorf("LoadShaders: %s", glctx.GetProgramInfoLog(program))
	}
	return nil
}
开发者ID:shazow,项目名称:go-gameblocks,代码行数:31,代码来源:shader.go

示例2: onStop

//停止时触发,清理
func onStop(glctx gl.Context) {
	glctx.DeleteProgram(program)
	glctx.DeleteBuffer(positionbuf)
	glctx.DeleteBuffer(colorbuf)
	fps.Release()
	images.Release()
}
开发者ID:lomoalbert,项目名称:gomobileapp,代码行数:8,代码来源:main.go

示例3: CreateProgram

// CreateProgram creates, compiles, and links a gl.Program.
func CreateProgram(glctx gl.Context, vertexSrc, fragmentSrc string) (gl.Program, error) {
	program := glctx.CreateProgram()
	if program.Value == 0 {
		return gl.Program{}, fmt.Errorf("glutil: no programs available")
	}

	vertexShader, err := loadShader(glctx, gl.VERTEX_SHADER, vertexSrc)
	if err != nil {
		return gl.Program{}, err
	}
	fragmentShader, err := loadShader(glctx, gl.FRAGMENT_SHADER, fragmentSrc)
	if err != nil {
		glctx.DeleteShader(vertexShader)
		return gl.Program{}, err
	}

	glctx.AttachShader(program, vertexShader)
	glctx.AttachShader(program, fragmentShader)
	glctx.LinkProgram(program)

	// Flag shaders for deletion when program is unlinked.
	glctx.DeleteShader(vertexShader)
	glctx.DeleteShader(fragmentShader)

	if glctx.GetProgrami(program, gl.LINK_STATUS) == 0 {
		defer glctx.DeleteProgram(program)
		return gl.Program{}, fmt.Errorf("glutil: %s", glctx.GetProgramInfoLog(program))
	}
	return program, nil
}
开发者ID:Christeefym,项目名称:lantern,代码行数:31,代码来源:glutil.go

示例4: onStop

func onStop(glctx gl.Context) {
	glctx.DeleteProgram(program)
	glctx.DeleteBuffer(buf)
	fps.Release()
	if statusPainter != nil {
		statusPainter.Release()
	}
	images.Release()
}
开发者ID:bmatsuo,项目名称:rex,代码行数:9,代码来源:main.go

示例5: appStop

// Use this to exit your game safely
// It will automatically unload all your assets and dispose the stage
// Schedule an exit from the application. On android, this will cause a call to pause() and dispose() some time in the future,
// it will not immediately finish your application.
// On iOS this should be avoided in production as it breaks Apples guidelines
func appStop(glctx gl.Context) {
	println("Exiting")
	running = false
	if currentScene.OnPause != nil {
		currentScene.OnPause(currentScene)
		soundsPlayer.Close()
	}
	glctx.DeleteProgram(program)
	glctx.DeleteBuffer(buf)
	fps.Release()
	images.Release()
}
开发者ID:pyros2097,项目名称:spike,代码行数:17,代码来源:spike.go

示例6: onStop

func onStop(glctx gl.Context) {
	manager.StopLayers()
	glctx.DeleteProgram(frameData.Program)
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:4,代码来源:main.go

示例7: onStop

func onStop(glctx gl.Context) {
	glctx.DeleteProgram(program)
	glctx.DeleteBuffer(buf)
	fps.Release()
	images.Release()
}
开发者ID:richiebful,项目名称:ptime,代码行数:6,代码来源:.main.go

示例8: Delete

func (prg Program) Delete(ctx gl.Context) {
	ctx.DeleteProgram(prg.Program)
}
开发者ID:dskinner,项目名称:material,代码行数:3,代码来源:gl.go

示例9: onStop

func onStop(glctx gl.Context) {
	glctx.DeleteProgram(program)
	board.Release()
	ReleaseSound()
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:5,代码来源:main.go


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