• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang f32.Bytes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initGL

func (video *Video) initGL() {
	log.Print("Initing")
	video.fpsmanager = gfx.NewFramerate()
	video.fpsmanager.SetFramerate(60)

	gl.ClearColor(0.0, 0.0, 0.0, 1.0)
	gl.Enable(gl.CULL_FACE)
	gl.Enable(gl.DEPTH_TEST)

	log.Print("Creating program")
	video.prog = createProgram(vertShaderSrcDef, fragShaderSrcDef)
	log.Print("Attrib loc 1")
	posAttrib := attribLocation(video.prog, "vPosition")
	log.Print("Attrib loc 2")
	texCoordAttr := attribLocation(video.prog, "vTexCoord")
	log.Print("Uniform loc 1")
	paletteLoc := uniformLocation(video.prog, "palette")
	log.Print("Uniform loc 2")
	video.textureUni = uniformLocation(video.prog, "texture")

	log.Print("Gen Texture")
	video.texture = genTexture()
	gl.ActiveTexture(gl.TEXTURE0)
	gl.BindTexture(gl.TEXTURE_2D, video.texture)

	log.Print("TexParam")
	gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
	gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST)

	gl.UseProgram(video.prog)
	gl.EnableVertexAttribArray(posAttrib)
	gl.EnableVertexAttribArray(texCoordAttr)

	gl.Uniform3iv(paletteLoc, nes.SPaletteRgb)

	log.Print("VertBO")
	vertVBO := genBuffer()
	checkGLError()
	gl.BindBuffer(gl.ARRAY_BUFFER, vertVBO)
	verts := f32.Bytes(binary.LittleEndian, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0)
	gl.BufferData(gl.ARRAY_BUFFER, verts, gl.STATIC_DRAW)

	textCoorBuf := genBuffer()
	checkGLError()
	gl.BindBuffer(gl.ARRAY_BUFFER, textCoorBuf)
	texVerts := f32.Bytes(binary.LittleEndian, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0)
	gl.BufferData(gl.ARRAY_BUFFER, texVerts, gl.STATIC_DRAW)

	gl.VertexAttribPointer(posAttrib, 2, gl.FLOAT, false, 0, 0)
	gl.VertexAttribPointer(texCoordAttr, 2, gl.FLOAT, false, 0, 0)
	log.Print("Started")
}
开发者ID:BluePadge,项目名称:Fergulator-Android,代码行数:52,代码来源:video.go


示例2: Start

func (e *Engine) Start() {
	var err error

	e.shader.program, err = LoadProgram("shader.v.glsl", "shader.f.glsl")
	if err != nil {
		panic(fmt.Sprintln("LoadProgram failed:", err))
	}

	e.shader.models, err = wavefront.Read("spiritframe.obj")
	check(err)

	e.shader.projectionmatrix = gl.GetUniformLocation(e.shader.program, "u_projectionMatrix")
	e.shader.viewmatrix = gl.GetUniformLocation(e.shader.program, "u_viewMatrix")
	e.shader.modelmatrix = gl.GetUniformLocation(e.shader.program, "u_modelMatrix")
	e.shader.normalmatrix = gl.GetUniformLocation(e.shader.program, "u_normalMatrix")
	e.shader.lightdir = gl.GetUniformLocation(e.shader.program, "u_lightDirection")
	e.shader.lightmatrix = gl.GetUniformLocation(e.shader.program, "u_lightmatrix")

	e.shader.vertCoord = gl.GetAttribLocation(e.shader.program, "a_vertex")
	e.shader.normal = gl.GetAttribLocation(e.shader.program, "a_normal")
	e.shader.texcoord = gl.GetAttribLocation(e.shader.program, "a_texCoord")

	for _, model := range e.shader.models {
		for _, group := range model.Groups {
			//颜色
			color := group.Material.Ambient
			//顶点
			data := f32.Bytes(binary.LittleEndian, group.Vertexes...)
			vertexCount := len(group.Vertexes) / 3
			databuf := gl.CreateBuffer()
			gl.BindBuffer(gl.ARRAY_BUFFER, databuf)
			gl.BufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW)
			//UV坐标
			textcoords := f32.Bytes(binary.LittleEndian, group.Textcoords...)
			uvbuf := gl.CreateBuffer()
			gl.BindBuffer(gl.ARRAY_BUFFER, uvbuf)
			gl.BufferData(gl.ARRAY_BUFFER, textcoords, gl.STATIC_DRAW)
			//发现坐标
			normals := f32.Bytes(binary.LittleEndian, group.Normals...)
			normalbuf := gl.CreateBuffer()
			gl.BindBuffer(gl.ARRAY_BUFFER, normalbuf)
			gl.BufferData(gl.ARRAY_BUFFER, normals, gl.STATIC_DRAW)

			tex, _ := LoadTexture(group.Material.Texturefile)
			e.shape.Objs = append(e.shape.Objs, Obj{vcount: vertexCount, coord: databuf, color: color, uvcoord: uvbuf, tex: tex, normal: normalbuf})

		}

	}
}
开发者ID:lovexiaov,项目名称:gomobileapp,代码行数:50,代码来源:main.go


示例3: Start

func (e *Engine) Start() {
	var err error

	e.shader.program, err = LoadProgram("shader.v.glsl", "shader.f.glsl")
	if err != nil {
		panic(fmt.Sprintln("LoadProgram failed:", err))
	}

	e.shader.models, err = wavefront.Read("girl.obj")
	check(err)

	e.shader.vertCoord = gl.GetAttribLocation(e.shader.program, "vertCoord")
	e.shader.vertTexCoord = gl.GetAttribLocation(e.shader.program, "vertTexCoord")
	e.shader.projection = gl.GetUniformLocation(e.shader.program, "projection")
	e.shader.view = gl.GetUniformLocation(e.shader.program, "view")
	e.shader.modelx = gl.GetUniformLocation(e.shader.program, "modelx")
	e.shader.modely = gl.GetUniformLocation(e.shader.program, "modely")
	e.shader.color = gl.GetUniformLocation(e.shader.program, "color")
	e.shader.useuv = gl.GetUniformLocation(e.shader.program, "useuv")

	for _, model := range e.shader.models {
		for _, group := range model.Groups {
			//颜色
			color := group.Material.Ambient
			//顶点
			data := f32.Bytes(binary.LittleEndian, group.Vertexes...)
			vertexCount := len(group.Vertexes) / 3
			databuf := gl.CreateBuffer()
			gl.BindBuffer(gl.ARRAY_BUFFER, databuf)
			gl.BufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW)
			//UV坐标
			textcoords := f32.Bytes(binary.LittleEndian, group.Textcoords...)
			uvbuf := gl.CreateBuffer()
			gl.BindBuffer(gl.ARRAY_BUFFER, uvbuf)
			gl.BufferData(gl.ARRAY_BUFFER, textcoords, gl.STATIC_DRAW)
			//贴图文件
			var useuv bool
			tex, err := LoadTexture(group.Material.Texturefile)
			if err != nil {
				useuv = false
			} else {
				useuv = true
			}
			e.shape.Objs = append(e.shape.Objs, Obj{vcount: vertexCount, coord: databuf, color: color, useuv: useuv, uvcoord: uvbuf, tex: tex})

		}

	}
}
开发者ID:lomoalbert,项目名称:gomobileapp,代码行数:49,代码来源:main.go


示例4: drawFrame

func (video *Video) drawFrame() {
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
	gl.UseProgram(video.prog)
	gl.ActiveTexture(gl.TEXTURE0)
	gl.BindTexture(gl.TEXTURE_2D, video.texture)

	log.Print("Reading")
	frame := <-video.pixelBuffer
	buf := make([]float32, len(frame))
	log.Print("Read frame")

	for k, v := range frame {
		buf[k] = float32(v)
	}

	log.Print("Writing")
	if video.pixelBuffer != nil {
		gl.TexImage2D(gl.TEXTURE_2D, 0, 256, 256, gl.RGBA,
			gl.UNSIGNED_SHORT_4_4_4_4, f32.Bytes(binary.LittleEndian, buf...))
	}
	log.Print("Wrote")

	gl.DrawArrays(gl.TRIANGLES, 0, 6)
	video.fpsmanager.FramerateDelay()
}
开发者ID:BluePadge,项目名称:Fergulator-Android,代码行数:25,代码来源:video.go


示例5: chart

func (r *Key) chart() {
	keys := []float32{
		// position    // Tex cordinates
		// top
		r.x, r.y, r.z, 0, 0, // top left
		r.x + r.length, r.y, r.z, 1, 0, // top right
		r.x, r.y + r.width, r.z, 0, 1, // bottom left
		r.x + r.length, r.y + r.width, r.z, 1, 1, // bottom right

		//front
		r.x + r.length, r.y, r.z, 1, 0,
		r.x + r.length, r.y + r.width, r.z, 1, 1,
		r.x + r.length, r.y, r.z - r.height, 1, 0,
		r.x + r.length, r.y + r.width, r.z - r.height, 1, 1,

		//left
		r.x, r.y + r.width, r.z, 0, 1,
		r.x + r.length, r.y + r.width, r.z, 1, 1,
		r.x, r.y + r.width, r.z - r.height, 1, 0,
		r.x + r.length, r.y + r.width, r.z - r.height, 0, 0,

		//right
		r.x, r.y, r.z, 0, 0,
		r.x + r.length, r.y, r.z, 1, 0,
		r.x, r.y, r.z - r.height, 0, 1,
		r.x + r.length, r.y, r.z - r.height, 1, 1,
	}

	r.data = append(r.data, f32.Bytes(binary.LittleEndian, keys...)...)
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:30,代码来源:key.go


示例6: makeTriangleData

func makeTriangleData() []byte {
	halfBase, halfHeight := computeTriangleLengths()
	return f32.Bytes(binary.LittleEndian,
		-halfBase, -halfHeight, 0.0,
		0.0, halfHeight, 0.0,
		halfBase, -halfHeight, 0.0,
	)
}
开发者ID:monopole,项目名称:volley,代码行数:8,代码来源:screen.go


示例7: circleTriangle

func circleTriangle() {

	x1, y1 := getXY(angle)
	x2, y2 := getXY(angle + math.Pi*2*1/3)
	x3, y3 := getXY(angle + math.Pi*2*2/3)

	triangleData = f32.Bytes(binary.LittleEndian,
		x1*0.4, y1*0.4, 0.0,
		x2*0.4, y2*0.4, 0.0,
		x3*0.4, y3*0.4, 0.0,
	)

	angle += math.Pi / 200
	if angle > math.Pi*2 {
		angle -= math.Pi * 2
	}
}
开发者ID:plumbum,项目名称:go-samples,代码行数:17,代码来源:main.go


示例8: makeWhiteKeyVector

// makeWhiteKeyVector creates 1) the OpenGL coordinates for the key in portrait and landscape mode
// 2) the box of the actual key and 3) the greater outer outline of the key which includes the surrounding gap
func makeWhiteKeyVector(width float32, count int) ([]byte, util.Boundary, util.Boundary) {

	keyOutline := util.Boundary{BottomY: 0.0, TopY: TopOfKey}
	// Which white key are we on. Start at that offset.
	offset := (float32(count)) / NumberOfWhiteKeys * util.MaxGLSize
	// Width of window / NumberOfWhiteKeys = width of each white key = w_k
	widthOfOneKey := width / NumberOfWhiteKeys

	keyOuterBoundary := util.Boundary{BottomY: 0.0, TopY: TopOfKey, LeftX: offset,
		RightX: offset + widthOfOneKey/width*util.MaxGLSize}

	// want KeytoGapRatio% of the width of a key to be white (allow for black separation between keys) = p
	// Top left & bottom left (x = (offset + ((1-p) / 2) *w_k) / width * MaxGLSize)
	// Top right & bottom right (x = (offset + w_k-(w_k* (1-p) / 2)) / width * MaxGLsize)
	keyOutline.RightX = offset + (widthOfOneKey-(widthOfOneKey*(1-KeytoGapRatio)/2))/width*util.MaxGLSize
	keyOutline.LeftX = offset + (widthOfOneKey*(1-KeytoGapRatio)/2)/width*util.MaxGLSize
	return f32.Bytes(binary.LittleEndian, makeCoordsForBothOrientation(keyOutline)...),
		keyOutline, keyOuterBoundary
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:21,代码来源:white_key.go


示例9: makeBlackKeyVector

// makeBlackKeyVector creates 1) the OpenGL coordinates for the key in portrait and landscape mode
// 2) the box of the actual key and 3) the greater outer outline of the key which includes the surrounding gap
func makeBlackKeyVector(leftWhiteKey Key) ([]byte, util.Boundary, util.Boundary) {

	// First, let's get the width of the white key.
	widthOfWhiteKey := leftWhiteKey.GetOuterBoundary().RightX - leftWhiteKey.GetOuterBoundary().LeftX
	// Determine the width of the blackKey with whiteKeyToBlackKeyWidthRatio
	widthOfBlackKey := whiteKeyToBlackKeyWidthRatio * widthOfWhiteKey
	// Use the end of the white key as the center of the black key and add the offsets to the sides.
	keyOuterBoundary := util.Boundary{BottomY: TopOfKey - whiteKeyToBlackKeyLengthRatio*TopOfKey,
		TopY:   TopOfKey,
		LeftX:  leftWhiteKey.GetOuterBoundary().RightX - (widthOfBlackKey / 2),
		RightX: leftWhiteKey.GetOuterBoundary().RightX + (widthOfBlackKey / 2)}
	// Use the same gap the white key uses for the black key
	gap := leftWhiteKey.GetOutline().LeftX - leftWhiteKey.GetOuterBoundary().LeftX

	keyOutline := util.Boundary{TopY: TopOfKey, BottomY: keyOuterBoundary.BottomY + gap,
		LeftX: keyOuterBoundary.LeftX + gap, RightX: keyOuterBoundary.RightX - gap}
	return f32.Bytes(binary.LittleEndian, makeCoordsForBothOrientation(keyOutline)...),
		keyOutline, keyOuterBoundary
}
开发者ID:xnattack,项目名称:GCSolutions,代码行数:21,代码来源:black_key.go


示例10:

	gl.EnableVertexAttribArray(glimage.pos)
	gl.VertexAttribPointer(glimage.pos, 2, gl.FLOAT, false, 0, 0)

	gl.BindBuffer(gl.ARRAY_BUFFER, glimage.quadUV)
	gl.EnableVertexAttribArray(glimage.inUV)
	gl.VertexAttribPointer(glimage.inUV, 2, gl.FLOAT, false, 0, 0)

	gl.DrawArrays(gl.TRIANGLE_STRIP, 0, 4)

	gl.DisableVertexAttribArray(glimage.pos)
	gl.DisableVertexAttribArray(glimage.inUV)
}

var quadXYCoords = f32.Bytes(binary.LittleEndian,
	-1, +1, // top left
	+1, +1, // top right
	-1, -1, // bottom left
	+1, -1, // bottom right
)

var quadUVCoords = f32.Bytes(binary.LittleEndian,
	0, 0, // top left
	1, 0, // top right
	0, 1, // bottom left
	1, 1, // bottom right
)

const vertexShader = `#version 100
uniform mat3 mvp;
uniform mat3 uvp;
attribute vec3 pos;
attribute vec2 inUV;
开发者ID:rockxcn,项目名称:mobile,代码行数:32,代码来源:glimage.go


示例11:

var cubeData = f32.Bytes(binary.LittleEndian, //三角
	0.5, 0.5, 0.5,
	0.5, 0.5, -0.5,

	0.5, 0.5, -0.5,
	0.5, -0.5, -0.5,

	0.5, -0.5, -0.5,
	0.5, -0.5, 0.5,

	0.5, -0.5, 0.5,
	0.5, 0.5, 0.5,

	-0.5, 0.5, 0.5,
	-0.5, 0.5, -0.5,

	-0.5, 0.5, -0.5,
	-0.5, -0.5, -0.5,

	-0.5, -0.5, -0.5,
	-0.5, -0.5, 0.5,

	-0.5, -0.5, 0.5,
	-0.5, 0.5, 0.5,

	0.5, 0.5, 0.5,
	-0.5, 0.5, 0.5,

	0.5, 0.5, -0.5,
	-0.5, 0.5, -0.5,

	0.5, -0.5, -0.5,
	-0.5, -0.5, -0.5,

	0.5, -0.5, 0.5,
	-0.5, -0.5, 0.5,
)
开发者ID:lovexiaov,项目名称:gomobileapp,代码行数:37,代码来源:main.go


示例12:

void main() {
	gl_FragColor = color;
}`

	coordsPerVertex         = 3
	vertexCount             = 3
	triangleSide    float32 = 0.4 // In OpenGL coordinates where the full screen in of size 2 [-1, 1]
	bannerWidth             = 0.1
)

var (
	triangleHeight       = float32(math.Sqrt(3)) * triangleSide / 2
	triangleCenterHeight = triangleSide / (2 * float32(math.Sqrt(3)))
	triangleData         = f32.Bytes(binary.LittleEndian,
		-triangleSide/2, -triangleHeight/2, 0, // bottom left
		0, triangleHeight/2, 0, // top
		triangleSide/2, -triangleHeight/2, 0, // bottom right
	)
	topBannerData = f32.Bytes(binary.LittleEndian,
		-1, 1, 0,
		1, 1, 0,
		1, 1-bannerWidth, 0,
		-1, 1-bannerWidth, 0,
	)
	leftBannerData = f32.Bytes(binary.LittleEndian,
		-1, 1, 0,
		-1+bannerWidth, 1, 0,
		-1+bannerWidth, -1, 0,
		-1, -1, 0,
	)
)
开发者ID:asimshankar,项目名称:triangles,代码行数:31,代码来源:gl.go


示例13:

var triangleData = f32.Bytes(binary.LittleEndian,
	// front
	-1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 0, 1,
	1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 0, 1,
	1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 0, 1,
	1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 0, 1,
	-1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 0, 1,
	-1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 0, 1,
	// top
	-1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 1, 0,
	1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 1, 0,
	1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 1, 0,
	1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 1, 0,
	-1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 1, 0,
	-1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, 1, 0,
	// back
	-1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 0, -1,
	1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 0, -1,
	1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 0, -1,
	1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 0, -1,
	-1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 0, -1,
	-1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, 0, -1,
	// bottom
	-1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, -1, 0,
	1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, -1, 0,
	1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, -1, 0,
	1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, -1, 0,
	-1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, 0, -1, 0,
	-1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 0, -1, 0,
	// left
	-1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 1, 0, 0,
	-1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, 1, 0, 0,
	-1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 1, 0, 0,
	-1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, 1, 0, 0,
	-1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, 1, 0, 0,
	-1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, 1, 0, 0,
	// right
	1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, -1, 0, 0,
	1.0, -1.0, -1.0, 0.98, 0.972, 0.94, 1, -1, 0, 0,
	1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, -1, 0, 0,
	1.0, 1.0, -1.0, 0.98, 0.972, 0.94, 1, -1, 0, 0,
	1.0, 1.0, 1.0, 0.98, 0.972, 0.94, 1, -1, 0, 0,
	1.0, -1.0, 1.0, 0.98, 0.972, 0.94, 1, -1, 0, 0,
)
开发者ID:rakyll,项目名称:GCSolutions,代码行数:44,代码来源:main.go


示例14:

	mu.Unlock()

	c := &http.Client{Transport: transport}
	_, err := c.Do(req)
	if err != nil {
		fmt.Println(err)
	}

	mu.Lock()
	req = nil
	mu.Unlock()
}

var rectData = f32.Bytes(binary.LittleEndian,
	0, 0,
	0, 0.2,
	0.2, 0,
	0.2, 0.2,
)

const vertexShader = `#version 100
uniform vec2 offset;

attribute vec4 position;
void main() {
  // offset comes in with x/y values between 0 and 1.
  // position bounds are -1 to 1.
  vec4 offset4 = vec4(2.0*offset.x-1.0, 1.0-2.0*offset.y, 0, 0);
  gl_Position = position + offset4;
}`

const fragmentShader = `#version 100
开发者ID:natasharomanoff,项目名称:blinker,代码行数:32,代码来源:main.go


示例15:

	glctx.Uniform2f(offset, touchX/float32(sz.WidthPx), touchY/float32(sz.HeightPx))

	glctx.BindBuffer(gl.ARRAY_BUFFER, buf)
	glctx.EnableVertexAttribArray(position)
	glctx.VertexAttribPointer(position, coordsPerVertex, gl.FLOAT, false, 0, 0)
	glctx.DrawArrays(gl.TRIANGLES, 0, vertexCount)
	glctx.DisableVertexAttribArray(position)

	statusPainter.Draw(sz, actionBarPad, statusFaceOpt)
	fps.Draw(sz)
}

var triangleData = f32.Bytes(binary.LittleEndian,
	0.0, 0.4, 0.0, // top left
	0.0, 0.0, 0.0, // bottom left
	0.4, 0.0, 0.0, // bottom right
)

const (
	coordsPerVertex = 3
	vertexCount     = 3
)

const vertexShader = `#version 100
uniform vec2 offset;

attribute vec4 position;
void main() {
	// offset comes in with x/y values between 0 and 1.
	// position bounds are -1 to 1.
开发者ID:bmatsuo,项目名称:rex,代码行数:30,代码来源:main.go


示例16:

package main

import (
	"encoding/binary"
	"golang.org/x/mobile/exp/f32"
)

var dswastikaData = f32.Bytes(binary.LittleEndian,
	0.0, -0.5, 0.0, 0.0, 0.5, 0.0,
	-0.5, -0.5, 0.0, 0.0, -0.5, 0.0,
	0.0, 0.5, 0.0, 0.5, 0.5, 0.0,

	-0.5, 0.5, 0.0, -0.5, 0.0, 0.0,
	-0.5, 0.0, 0.0, 0.5, 0.0, 0.0,
	0.5, 0.0, 0.0, 0.5, -0.5, 0.0,
)

var swastikaData = f32.Bytes(binary.LittleEndian,
	-0.4, -0.2, 0.0, 0.0, 0.4, 0.0,
	-0.4, -0.2, 0.0, 0.4, -0.2, 0.0,
	0.0, 0.4, 0.0, 0.4, -0.2, 0.0,

	-0.4, 0.2, 0.0, 0.4, 0.2, 0.0,
	-0.4, 0.2, 0.0, 0.0, -0.4, 0.0,
	0.0, -0.4, 0.0, 0.4, 0.2, 0.0,
)

var quadData = f32.Bytes(binary.LittleEndian,
	-0.3, -0.3, 0.0,
	0.3, -0.3, 0.0,
	0.3, 0.3, 0.0,
开发者ID:gitter-badger,项目名称:bukkake,代码行数:31,代码来源:data.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang f32.Affine类代码示例发布时间:2022-05-28
下一篇:
Golang al.PlaySources函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap