func DepthMask(flag bool) { b := C.GLboolean(C.GL_FALSE) if flag { b = C.GLboolean(C.GL_TRUE) } C.glDepthMask(b) }
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)) }
func glBoolean(n bool) C.GLboolean { var b int if n == true { b = 1 } return C.GLboolean(b) }
// 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)) }
// 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))) }
// 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) }
//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) }
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) }
func Init() GLenum { C.SetGlewExperimental(C.GLboolean(1)) return GLenum(C.glewInit()) }
func (u UniformMatrix4f) Setv(data []float32) { C.glUniformMatrix4fv(u.location, C.GLsizei(len(data)/16), C.GLboolean(C.GL_FALSE), (*C.GLfloat)(&data[0])) }
func (u UniformMatrix4f) Set(data [16]float32) { C.glUniformMatrix4fv(u.location, 1, C.GLboolean(C.GL_FALSE), (*C.GLfloat)(&data[0])) }
func (quad *GLUquadric) QuadricTexture(texture gl.GLboolean) { C.gluQuadricTexture((*C.GLUquadric)(quad), C.GLboolean(texture)) }