示例#1
0
文件: gl.go 项目: jackscan/go-gles2
func DepthMask(flag bool) {
	b := C.GLboolean(C.GL_FALSE)
	if flag {
		b = C.GLboolean(C.GL_TRUE)
	}
	C.glDepthMask(b)
}
示例#2
0
文件: gl.go 项目: jackscan/go-gles2
func SampleCoverage(value float32, invert bool) {
	b := C.GLboolean(C.GL_FALSE)
	if invert {
		b = C.GLboolean(C.GL_TRUE)
	}

	C.glSampleCoverage(C.GLclampf(value), C.GLboolean(b))
}
示例#3
0
func glBoolean(n bool) C.GLboolean {
	var b int
	if n == true {
		b = 1
	}
	return C.GLboolean(b)
}
示例#4
0
文件: gl.go 项目: extrame/gl
// ColorMask calls glColorMask
func ColorMask(r, g, b, a bool) {
	R, G, B, A := FALSE, FALSE, FALSE, FALSE
	if r {
		R = TRUE
	}
	if g {
		G = TRUE
	}
	if b {
		B = TRUE
	}
	if a {
		A = TRUE
	}
	C.glColorMask(C.GLboolean(R), C.GLboolean(G), C.GLboolean(B), C.GLboolean(A))
}
示例#5
0
文件: vertices.go 项目: eaburns/gl
// Pointer defines an array of generic vertex attribute data.
func (l VertexAttribArray) Pointer(sz int, t DataType, norm bool, stride, offs int) {
	n := 0
	if norm {
		n = 1
	}
	C.glVertexAttribPointer(C.GLuint(l), C.GLint(sz), C.GLenum(t), C.GLboolean(n), C.GLsizei(stride), unsafe.Pointer(uintptr(offs)))
}
示例#6
0
文件: gl.go 项目: extrame/gl
// EnableAttrib calls glEnableVertexAttribArray and glVertexAttribPointer to activate an attribute and connect it to a buffer object.
// offset specifies the first vertex, stride specifies the distance from the beginning of one vertex to the next, size specifies the number of components in a vertex (all these arguments are in units of array elements, not bytes like the underlying API).
// The byte offset of component j of vertex i is thus calculated as: sizeof(data[0]) * (offset + stride * i + j), where data is the parameter passed to Buffer.Set
func (p *Program) EnableAttrib(loc string, buf *Buffer, offset int, size int, stride int, norm bool) {
	n := FALSE
	if norm {
		n = TRUE
	}
	buf.Bind(ARRAY_BUFFER)
	attr := p.attr[loc]
	C.glEnableVertexAttribArray(attr)
	C.glVertexAttribPointer(attr, C.GLint(size), buf.t, C.GLboolean(n), C.GLsizei(stride*buf.ts), unsafe.Pointer(uintptr(buf.ts*offset)))
	buf.Unbind(ARRAY_BUFFER)
}
示例#7
0
文件: callback.go 项目: 0xfaded/glu
//export goTessEdgeFlagData
func goTessEdgeFlagData(flag C.GLboolean, tessPtr unsafe.Pointer) {
	var tess *Tesselator = (*Tesselator)(tessPtr)
	if tess == nil || tess.edgeFlagData == nil {
		return
	}
	var goFlag bool
	if C.GLboolean(0) == flag {
		goFlag = false
	} else {
		goFlag = true
	}

	tess.edgeFlagData(goFlag, tess.polyData)
}
示例#8
0
文件: gl.go 项目: jackscan/go-gles2
func ColorMask(red, green, blue, alpha bool) {
	r, g, b, a := C.GLboolean(C.GL_FALSE), C.GLboolean(C.GL_FALSE), C.GLboolean(C.GL_FALSE), C.GLboolean(C.GL_FALSE)
	if red {
		r = C.GLboolean(C.GL_TRUE)
	}
	if green {
		g = C.GLboolean(C.GL_TRUE)
	}
	if blue {
		b = C.GLboolean(C.GL_TRUE)
	}
	if alpha {
		a = C.GLboolean(C.GL_TRUE)
	}
	C.glColorMask(r, g, b, a)
}
示例#9
0
文件: gl.go 项目: james4k/gl
func Init() GLenum {
	C.SetGlewExperimental(C.GLboolean(1))
	return GLenum(C.glewInit())
}
示例#10
0
func (u UniformMatrix4f) Setv(data []float32) {
	C.glUniformMatrix4fv(u.location, C.GLsizei(len(data)/16), C.GLboolean(C.GL_FALSE), (*C.GLfloat)(&data[0]))
}
示例#11
0
func (u UniformMatrix4f) Set(data [16]float32) {
	C.glUniformMatrix4fv(u.location, 1, C.GLboolean(C.GL_FALSE), (*C.GLfloat)(&data[0]))
}
示例#12
0
文件: glu.go 项目: collects/Go-OpenGL
func (quad *GLUquadric) QuadricTexture(texture gl.GLboolean) {
	C.gluQuadricTexture((*C.GLUquadric)(quad), C.GLboolean(texture))
}