示例#1
0
func onDisplay(program uint32) {
	coords := uint32(attributeCoord2d)
	vcolor := uint32(attributeVColor)

	gl.ClearColor(1.0, 1.0, 1.0, 1.0)
	gl.Clear(gl.COLOR_BUFFER_BIT)

	gl.UseProgram(program)
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.Uniform1f(uniformFade, curFade)

	gl.EnableVertexAttribArray(coords)
	gl.EnableVertexAttribArray(vcolor)
	gl.BindBuffer(gl.ARRAY_BUFFER, vboTriangle)
	gl.VertexAttribPointer(coords, 2, gl.FLOAT, false, 5*floatSize, nil)
	gl.VertexAttribPointer(vcolor, 3, gl.FLOAT, false, 5*floatSize, gl.PtrOffset(2*floatSize))

	gl.DrawArrays(gl.TRIANGLES, 0, 3)

	gl.DisableVertexAttribArray(vcolor)
	gl.DisableVertexAttribArray(coords)
}
示例#2
0
文件: gl_opengl.go 项目: tanema/amore
// Uniform1f writes a float uniform variable.
//
// http://www.khronos.org/opengles/sdk/docs/man3/html/glUniform.xhtml
func Uniform1f(dst Uniform, v float32) {
	gl.Uniform1f(dst.Value, v)
}
示例#3
0
文件: gl_gl2.go 项目: EngoEngine/gl
// Specify the value of a uniform variable for the current program object
func (c *Context) Uniform1f(location *UniformLocation, x float32) {
	gl.Uniform1f(location.int32, x)
}
示例#4
0
文件: gg.go 项目: dmac/gg
func (*backend) Uniform1f(u *gg.Uniform, v0 float32) {
	gl.Uniform1f(u.Value.(int32), v0)
}