Exemplo n.º 1
0
func DepthMask(flag bool) {
	b := C.GLboolean(C.GL_FALSE)
	if flag {
		b = C.GLboolean(C.GL_TRUE)
	}
	C.glDepthMask(b)
}
Exemplo n.º 2
0
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))
}
Exemplo n.º 3
0
func glBoolean(n bool) C.GLboolean {
	var b int
	if n == true {
		b = 1
	}
	return C.GLboolean(b)
}
Exemplo n.º 4
0
Arquivo: gl.go Projeto: 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))
}
Exemplo n.º 5
0
// 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)))
}
Exemplo n.º 6
0
Arquivo: gl.go Projeto: 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)
}
Exemplo n.º 7
0
//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)
}
Exemplo n.º 8
0
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)
}
Exemplo n.º 9
0
Arquivo: gl.go Projeto: james4k/gl
func Init() GLenum {
	C.SetGlewExperimental(C.GLboolean(1))
	return GLenum(C.glewInit())
}
Exemplo n.º 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]))
}
Exemplo n.º 11
0
func (u UniformMatrix4f) Set(data [16]float32) {
	C.glUniformMatrix4fv(u.location, 1, C.GLboolean(C.GL_FALSE), (*C.GLfloat)(&data[0]))
}
Exemplo n.º 12
0
func (quad *GLUquadric) QuadricTexture(texture gl.GLboolean) {
	C.gluQuadricTexture((*C.GLUquadric)(quad), C.GLboolean(texture))
}