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


Golang glutil.NewImages函数代码示例

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


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

示例1: onStart

func onStart(glctx gl.Context) {
	var err error
	program, err = glutil.CreateProgram(glctx, vertexShader, fragmentShader)
	if err != nil {
		log.Printf("[ERR] Failed creating GL program: %v", err)
		return
	}

	buf = glctx.CreateBuffer()
	glctx.BindBuffer(gl.ARRAY_BUFFER, buf)
	glctx.BufferData(gl.ARRAY_BUFFER, triangleData, gl.STATIC_DRAW)

	position = glctx.GetAttribLocation(program, "position")
	color = glctx.GetUniformLocation(program, "color")
	offset = glctx.GetUniformLocation(program, "offset")

	images = glutil.NewImages(glctx)
	fps = debug.NewFPS(images)

	statusFont, statusFace, err = exfont.LoadAsset("Tuffy.ttf", statusFaceOpt)
	if err != nil {
		log.Printf("[ERR] Failed to load status font: %v", err)
	}
	statusPainter = rexdemo.NewStatusPainter(demo, statusFont, _color.White, images)
}
开发者ID:bmatsuo,项目名称:rex,代码行数:25,代码来源:main.go

示例2: onStart

func onStart(glctx gl.Context, u *uistate.UIState) {
	flag.Set("v23.credentials", "/sdcard/credentials")
	vlog.Log.Configure(vlog.OverridePriorConfiguration(true), vlog.LogToStderr(true))
	vlog.Log.Configure(vlog.OverridePriorConfiguration(true), vlog.Level(0))
	ctx, shutdown := v23.Init()
	u.Shutdown = shutdown
	u.Ctx = ctx
	u.Service = syncbase.NewService(util.MountPoint + "/croupier/" + util.SBName)
	namespace := v23.GetNamespace(u.Ctx)
	allAccess := access.AccessList{In: []security.BlessingPattern{"..."}}
	permissions := access.Permissions{
		"Admin":   allAccess,
		"Write":   allAccess,
		"Read":    allAccess,
		"Resolve": allAccess,
		"Debug":   allAccess,
	}
	namespace.SetPermissions(u.Ctx, util.MountPoint, permissions, "")
	namespace.SetPermissions(u.Ctx, util.MountPoint+"/croupier", permissions, "")
	u.Service.SetPermissions(u.Ctx, permissions, "")
	u.Images = glutil.NewImages(glctx)
	fps = debug.NewFPS(u.Images)
	u.Eng = glsprite.Engine(u.Images)
	u.Texs = texture.LoadTextures(u.Eng)
	u.CurTable = table.InitializeGame(u.NumPlayers, u.Texs)
	sound.InitPlayers(u)
	sync.CreateTables(u)
	// Create watch stream to update game state based on Syncbase updates
	go sync.UpdateSettings(u)
}
开发者ID:vanadium,项目名称:croupier,代码行数:30,代码来源:main.go

示例3: onStart

func onStart(glctx gl.Context) {
	var err error
	program, err = glutil.CreateProgram(glctx, vertexShader, fragmentShader)
	if err != nil {
		log.Printf("[ERR] Failed creating GL program: %v", err)
		return
	}

	buf = glctx.CreateBuffer()
	glctx.BindBuffer(gl.ARRAY_BUFFER, buf)
	glctx.BufferData(gl.ARRAY_BUFFER, triangleData, gl.STATIC_DRAW)

	position = glctx.GetAttribLocation(program, "position")
	color = glctx.GetUniformLocation(program, "color")
	offset = glctx.GetUniformLocation(program, "offset")

	images = glutil.NewImages(glctx)
	fps = debug.NewFPS(images)

	statusFont, statusFace, err = exfont.LoadAsset("Tuffy.ttf", statusFaceOpt)
	if err != nil {
		log.Printf("[ERR] Failed to load status font: %v", err)
	}
	statusPainter = rexdemo.NewStatusPainter(demo, statusFont, statusBG, images)

	ifaces, err := net.Interfaces()
	if err != nil {
		log.Printf("[ERR] Failed to retreived interfaces")
	} else {
		log.Printf("[DEBUG] %d network interfaces", len(ifaces))
		for _, iface := range ifaces {
			log.Printf("[DEBUG] IFACE %d %s", iface.Index, iface.Name)
		}
	}
}
开发者ID:gophergala2016,项目名称:rex,代码行数:35,代码来源:main.go

示例4: onStart

func onStart(glctx gl.Context, sz size.Event) {
	images = glutil.NewImages(glctx)
	eng = glsprite.Engine(images)
	log = gmlog.New(images, 5)
	bbot = NewApp()
	bbot.Reset(sz)
	scene = bbot.Scene(eng, sz)
}
开发者ID:viru,项目名称:berrybot,代码行数:8,代码来源:main.go

示例5: NewGLDebug

func NewGLDebug(ctx gl.Context) *GLDebug {
	if ctx == nil {
		return nil
	}
	images := glutil.NewImages(ctx)
	return &GLDebug{
		ctx:    ctx,
		images: images,
		fps:    debug.NewFPS(images),
	}
}
开发者ID:asimshankar,项目名称:triangles,代码行数:11,代码来源:gldebug.go

示例6: Initialize

func (self *GLPeer) Initialize(in_glctx gl.Context) {
	LogDebug("IN")
	self.glctx = in_glctx

	// transparency of png
	self.glctx.Enable(gl.BLEND)
	self.glctx.BlendEquation(gl.FUNC_ADD)
	self.glctx.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	self.images = glutil.NewImages(in_glctx)
	self.fps = debug.NewFPS(self.images)
	self.initEng()
	LogDebug("OUT")
}
开发者ID:sassy,项目名称:gomo-simra,代码行数:13,代码来源:peer.go

示例7: onPaint

func onPaint(sz size.Event) {
	if scene == nil {
		images = glutil.NewImages()
		fps = debug.NewFPS(images)
		eng = glsprite.Engine(images)
		loadScene()
	}
	gl.ClearColor(1, 1, 1, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT)
	now := clock.Time(time.Since(startTime) * 60 / time.Second)
	eng.Render(scene, now, sz)
	fps.Draw(sz)
}
开发者ID:samanalysis,项目名称:mobile,代码行数:13,代码来源:main.go

示例8: onStart

func onStart(glctx gl.Context) {
	images = glutil.NewImages(glctx)
	eng = glsprite.Engine(images)
	loadScene()

	rc, err := asset.Open("boing.wav")
	if err != nil {
		log.Fatal(err)
	}
	player, err = audio.NewPlayer(rc, 0, 0)
	if err != nil {
		log.Fatal(err)
	}
}
开发者ID:0x90sled,项目名称:mobile,代码行数:14,代码来源:main.go

示例9: onStart

func onStart(glctx gl.Context) {
	var err error
	program, err = glutil.CreateProgram(glctx, vertexShader, fragmentShader)
	if err != nil {
		log.Printf("error creating GL program: %v", err)
		return
	}
	buf = glctx.CreateBuffer()
	glctx.BindBuffer(gl.ARRAY_BUFFER, buf)
	glctx.BufferData(gl.ARRAY_BUFFER, triangleData, gl.STATIC_DRAW)
	position = glctx.GetAttribLocation(program, "position")
	color = glctx.GetUniformLocation(program, "color")
	offset = glctx.GetUniformLocation(program, "offset")
	images = glutil.NewImages(glctx)
	fps = debug.NewFPS(images)
}
开发者ID:lomoalbert,项目名称:gomobileapp,代码行数:16,代码来源:main.go

示例10: onStart

func onStart(glctx gl.Context, sz size.Event) {
	images = glutil.NewImages(glctx)

	colors := []color.RGBA{
		{52, 152, 219, 1},
		{231, 76, 60, 1},
		{52, 73, 94, 1},
		{46, 204, 113, 1},
	}

	for c := 0; c < gridColumnsCount; c++ {
		for r := 0; r < gridrowsCount; r++ {
			t := &grid[((c+1)*(r+1))-1]
			t.image = images.NewImage(int(sz.PixelsPerPt*tileSize), int(sz.PixelsPerPt*tileSize))
			t.color = colors[random(0, 4)]
		}
	}
}
开发者ID:plixul,项目名称:figura,代码行数:18,代码来源:main.go

示例11: onStart

func onStart(glctx gl.Context) {
	var err error
	program, err = glutil.CreateProgram(glctx, vertexShader, fragmentShader)
	if err != nil {
		log.Printf("error creating GL program: %v", err)
		return
	}

	glctx.Enable(gl.DEPTH_TEST)

	triBuf = glctx.CreateBuffer()
	glctx.BindBuffer(gl.ARRAY_BUFFER, triBuf)
	glctx.BufferData(gl.ARRAY_BUFFER, triangleData, gl.STATIC_DRAW)

	position = glctx.GetAttribLocation(program, "vPos")
	color = glctx.GetAttribLocation(program, "vCol")
	normals = glctx.GetAttribLocation(program, "vNorm")

	projection = glctx.GetUniformLocation(program, "proj")
	view = glctx.GetUniformLocation(program, "view")
	model = glctx.GetUniformLocation(program, "model")
	tint = glctx.GetUniformLocation(program, "tint")
	normalMatrix = glctx.GetUniformLocation(program, "normalMatrix")
	lightIntensity = glctx.GetUniformLocation(program, "light.intensities")
	lightPos = glctx.GetUniformLocation(program, "light.position")

	arcball = NewArcBall(mgl32.Vec3{0, 0, 0}, mgl32.Vec3{0, 10, 10}, mgl32.Vec3{0, 1, 0})

	white = mgl32.Vec4{1.0, 1.0, 1.0, 1.0}
	red = mgl32.Vec4{1.0, 0.0, 0.0, 1.0}

	lastUpdate = time.Now()

	images = glutil.NewImages(glctx)
	fps = debug.NewFPS(images)

	err = al.OpenDevice()
	if err != nil {
		log.Printf("Err: %+v", err)
	}
	al.SetListenerPosition(al.Vector{0, 0, 0})
	al.SetListenerGain(1.0)
	piano = NewPiano()
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:44,代码来源:main.go

示例12: onStart

func onStart(glctx gl.Context) {
	var err error
	program, err = glutil.CreateProgram(glctx, vertexShader, fragmentShader)
	if err != nil {
		log.Printf("error creating GL program: %v", err)
		return
	}

	triangleData = genCircleTriangles(0.0, 0.0, 0.5)

	buf = glctx.CreateBuffer()

	position = glctx.GetAttribLocation(program, "position")
	color = glctx.GetUniformLocation(program, "color")
	offset = glctx.GetUniformLocation(program, "offset")

	images = glutil.NewImages(glctx)
	fps = debug.NewFPS(images)
}
开发者ID:richiebful,项目名称:ptime,代码行数:19,代码来源:.main.go

示例13: appStart

func appStart(glctx gl.Context) {
	println("Starting")
	program, err = glutil.CreateProgram(glctx, vertexShader, fragmentShader)
	if err != nil {
		panic("error creating GL program: " + err.Error())
		return
	}

	buf = glctx.CreateBuffer()
	glctx.BindBuffer(gl.ARRAY_BUFFER, buf)
	glctx.BufferData(gl.ARRAY_BUFFER, triangleData, gl.STATIC_DRAW)

	position = glctx.GetAttribLocation(program, "position")
	color = glctx.GetUniformLocation(program, "color")
	offset = glctx.GetUniformLocation(program, "offset")
	images = glutil.NewImages(glctx)
	fps = debug.NewFPS(images)

	SetScene(currentScene.Name)
}
开发者ID:pyros2097,项目名称:spike,代码行数:20,代码来源:spike.go

示例14: Start

func (e *engine) Start(glctx gl.Context) error {
	e.glctx = glctx
	e.shaders = loader.ShaderLoader(glctx)
	e.textures = loader.TextureLoader(glctx)

	err := e.world.Start(WorldContext{
		Bindings: e.bindings,
		Shaders:  e.shaders,
		Textures: e.textures,
	})
	if err != nil {
		return err
	}

	e.camera.MoveTo(e.followOffset)
	e.camera.RotateTo(e.world.Focus().Position())

	// Toggle keys
	e.bindings.On(control.KeyPause, func(_ control.KeyBinding) {
		e.paused = !e.paused
		log.Println("Paused:", e.paused)

		if e.gameover {
			e.gameover = false
			e.world.Reset()
		}
	})
	e.bindings.On(control.KeyCameraFollow, func(_ control.KeyBinding) {
		e.following = !e.following
		log.Println("Following:", e.following)
	})

	e.started = time.Now()
	e.lastTick = e.started

	e.images = glutil.NewImages(glctx)
	e.fps = debug.NewFPS(e.images)

	log.Println("Starting: ", e.world.String())
	return nil
}
开发者ID:shazow,项目名称:go-gameblocks,代码行数:41,代码来源:engine.go

示例15: main

// main is the entry point of the application. This is function gets registered
// as the main function of the application.
func (m *Module) main(a app.App) {
	var images *glutil.Images
	var glctx gl.Context
	sz := size.Event{}

	m.Render.InitApp(a)

	ticker := time.NewTicker(time.Second)

	for {
		select {
		case <-ticker.C:
			a.Send(paint.Event{})

		case <-m.Network.Updated():
			m.loaded = true

		case e := <-a.Events():
			switch e := a.Filter(e).(type) {
			case lifecycle.Event:
				glctx, _ = e.DrawContext.(gl.Context)
				if glctx != nil {
					glctx = e.DrawContext.(gl.Context)
					if images != nil {
						images.Release()
					}
					images = glutil.NewImages(glctx)
				}
			case size.Event:
				sz = e
			case paint.Event:
				m.draw(glctx, sz, images)
				a.Publish()
			}
		}
	}
}
开发者ID:jbowens,项目名称:muni-display,代码行数:39,代码来源:app.go


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