Ejemplo n.º 1
0
// void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
func GetRenderbufferParameteriv(target, pname GLenum, params []int32) {
	if len(params) == 0 {
		panic(ErrorInputSize)
	}

	C.glGetRenderbufferParameteriv(C.GLenum(target), C.GLenum(pname), (*C.GLint)(&params[0]))
}
Ejemplo n.º 2
0
func GetRenderbufferParameteriv(
	target Enum, pname Enum, params *int32) {
	C.glGetRenderbufferParameteriv(
		C.GLenum(target),
		C.GLenum(pname),
		(*C.GLint)(params))
}
Ejemplo n.º 3
0
func TexImage2D(target TextureTarget, level int, internalformat InternalFormat, width, height int, format TextureFormat, datatype DataType, pixels []uint8) {
	if pixels != nil {
		C.glTexImage2D(C.GLenum(target), C.GLint(level), C.GLint(internalformat), C.GLsizei(width), C.GLsizei(height), 0, C.GLenum(format), C.GLenum(datatype), unsafe.Pointer(&pixels[0]))
	} else {
		C.glTexImage2D(C.GLenum(target), C.GLint(level), C.GLint(internalformat), C.GLsizei(width), C.GLsizei(height), 0, C.GLenum(format), C.GLenum(datatype), unsafe.Pointer(nil))
	}
}
Ejemplo n.º 4
0
// void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
func GetRenderbufferParameteriv(target, pname GLenum, params []int32) {
	if len(params) == 0 {
		panic("Invalid params size")
	}

	C.glGetRenderbufferParameteriv(C.GLenum(target), C.GLenum(pname), (*C.GLint)(&params[0]))
}
Ejemplo n.º 5
0
func BlendEquationSeparate(
	modeRGB Enum, modeAlpha Enum) {
	C.glBlendEquationSeparate(
		C.GLenum(modeRGB),
		C.GLenum(modeAlpha))

}
Ejemplo n.º 6
0
func TexParameterf(
	target Enum, pname Enum, param float32) {
	C.glTexParameterf(
		C.GLenum(target),
		C.GLenum(pname),
		C.GLfloat(param))
}
Ejemplo n.º 7
0
func TexParameteriv(
	target Enum, pname Enum, params *int32) {
	C.glTexParameteriv(
		C.GLenum(target),
		C.GLenum(pname),
		(*C.GLint)(params))
}
Ejemplo n.º 8
0
func TexParameterfv(
	target Enum, pname Enum, params *float32) {
	C.glTexParameterfv(
		C.GLenum(target),
		C.GLenum(pname),
		(*C.GLfloat)(params))
}
Ejemplo n.º 9
0
func TexParameteri(
	target Enum, pname Enum, param int32) {
	C.glTexParameteri(
		C.GLenum(target),
		C.GLenum(pname),
		C.GLint(param))
}
Ejemplo n.º 10
0
func CopyTexImage2D(target uint, level int, internalformat uint,
	x, y, width, height, border int) {
	C.glCopyTexImage2D(
		C.GLenum(target), C.GLint(level), C.GLenum(internalformat),
		C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height),
		C.GLint(border))
}
Ejemplo n.º 11
0
func StencilOp(
	fail Enum, zfail Enum, zpass Enum) {
	C.glStencilOp(
		C.GLenum(fail),
		C.GLenum(zfail),
		C.GLenum(zpass))
}
Ejemplo n.º 12
0
func BlendFunc(
	sfactor Enum, dfactor Enum) {
	C.glBlendFunc(
		C.GLenum(sfactor),
		C.GLenum(dfactor))

}
Ejemplo n.º 13
0
func GetShaderPrecisionFormat(shadertype, precisiontype uint) (
	range_ int32, precision int32) {
	C.glGetShaderPrecisionFormat(
		C.GLenum(shadertype), C.GLenum(precisiontype),
		(*C.GLint)(&range_), (*C.GLint)(&precision))
	return
}
Ejemplo n.º 14
0
Archivo: gl.go Proyecto: extrame/gl
// Set calls glBufferData with appropriate arguments to load the data pointed to by data into the buffer. usage is passed along verbatim. targ is used for binding and it should most likely be ARRAY_BUFFER.
func (buf *Buffer) Set(targ int, data interface{}, usage int) {
	buf.Bind(targ)
	p, t, ts, s := toCtype(data)
	C.glBufferData(C.GLenum(targ), C.GLsizeiptr(s), p, C.GLenum(usage))
	buf.t = t
	buf.ts = ts
	buf.Unbind(targ)
}
Ejemplo n.º 15
0
func CompressedTexImage2D(target uint, level int, internalformat uint,
	width, height, border, imageSize int, data Void) {
	C.glCompressedTexImage2D(
		C.GLenum(target), C.GLint(level), C.GLenum(internalformat),
		C.GLsizei(width), C.GLsizei(height),
		C.GLint(border), C.GLsizei(imageSize),
		unsafe.Pointer(data))
}
Ejemplo n.º 16
0
func TexSubImage2D(target uint, level, xoffset, yoffset, width, height int,
	format, type_ uint, pixels Void) {

	C.glTexSubImage2D(C.GLenum(target), C.GLint(level),
		C.GLint(xoffset), C.GLint(yoffset), C.GLsizei(width), C.GLsizei(height),
		C.GLenum(format), C.GLenum(type_),
		unsafe.Pointer(pixels))
}
Ejemplo n.º 17
0
func GetFramebufferAttachmentParameteriv(
	target, attachment, pname uint, params []int32) []int32 {
	C.glGetFramebufferAttachmentParameteriv(
		C.GLenum(target), C.GLenum(attachment),
		C.GLenum(pname), (*C.GLint)(&params[0]))
	return params

}
Ejemplo n.º 18
0
func GetFramebufferAttachmentParameteriv(
	target Enum, attachment Enum, pname Enum, params *int32) {
	C.glGetFramebufferAttachmentParameteriv(
		C.GLenum(target),
		C.GLenum(attachment),
		C.GLenum(pname),
		(*C.GLint)(params))
}
Ejemplo n.º 19
0
func StencilFuncSeparate(
	face Enum, func_ Enum, ref int32, mask uint32) {
	C.glStencilFuncSeparate(
		C.GLenum(face),
		C.GLenum(func_),
		C.GLint(ref),
		C.GLuint(mask))
}
Ejemplo n.º 20
0
func CompressedTexSubImage2D(target uint, level, xoffset, yoffset int,
	width, height int, format uint, imageSize int, data Void) {
	C.glCompressedTexSubImage2D(
		C.GLenum(target), C.GLint(level),
		C.GLint(xoffset), C.GLint(yoffset),
		C.GLsizei(width), C.GLsizei(height),
		C.GLenum(format), C.GLsizei(imageSize),
		unsafe.Pointer(data))
}
Ejemplo n.º 21
0
func DrawElements(
	mode Enum, count Sizei,
	type_ Enum, indices Void) {
	C.glDrawElements(
		C.GLenum(mode),
		C.GLsizei(count),
		C.GLenum(type_),
		unsafe.Pointer(indices))
}
Ejemplo n.º 22
0
func FramebufferRenderbuffer(
	target Enum, attachment Enum,
	renderbuffertarget Enum, renderbuffer uint32) {
	C.glFramebufferRenderbuffer(
		C.GLenum(target),
		C.GLenum(attachment),
		C.GLenum(renderbuffertarget),
		C.GLuint(renderbuffer))
}
Ejemplo n.º 23
0
func StencilOpSeparate(
	face Enum, fail Enum,
	zfail Enum, zpass Enum) {
	C.glStencilOpSeparate(
		C.GLenum(face),
		C.GLenum(fail),
		C.GLenum(zfail),
		C.GLenum(zpass))
}
Ejemplo n.º 24
0
func GetShaderPrecisionFormat(
	shadertype Enum, precisiontype Enum,
	range_ *int32, precision *int32) {
	C.glGetShaderPrecisionFormat(
		C.GLenum(shadertype),
		C.GLenum(precisiontype),
		(*C.GLint)(range_),
		(*C.GLint)(precision))
}
Ejemplo n.º 25
0
func RenderbufferStorage(
	target Enum, internalformat Enum,
	width Sizei, height Sizei) {
	C.glRenderbufferStorage(
		C.GLenum(target),
		C.GLenum(internalformat),
		C.GLsizei(width),
		C.GLsizei(height))
}
Ejemplo n.º 26
0
func BufferData(
	target Enum, size SizeiPtr,
	data Void, usage Enum) {
	C.glBufferData(
		C.GLenum(target),
		C.GLsizeiptr(size),
		unsafe.Pointer(data),
		C.GLenum(usage))

}
Ejemplo n.º 27
0
func BlendFuncSeparate(
	srcRGB Enum, dstRGB Enum,
	srcAlpha Enum, dstAlpha Enum) {
	C.glBlendFuncSeparate(
		C.GLenum(srcRGB),
		C.GLenum(dstRGB),
		C.GLenum(srcAlpha),
		C.GLenum(dstAlpha))

}
Ejemplo n.º 28
0
func Build2DMipmaps(target uint32, internalFormat int, width, height int, format, typ uint32, data unsafe.Pointer) int {
	return int(C.gluBuild2DMipmaps(
		C.GLenum(target),
		C.GLint(internalFormat),
		C.GLsizei(width),
		C.GLsizei(height),
		C.GLenum(format),
		C.GLenum(typ),
		data))
}
Ejemplo n.º 29
0
func FramebufferTexture2D(
	target Enum, attachment Enum,
	textarget Enum, texture uint32, level int32) {
	C.glFramebufferTexture2D(
		C.GLenum(target),
		C.GLenum(attachment),
		C.GLenum(textarget),
		C.GLuint(texture),
		C.GLint(level))
}
Ejemplo n.º 30
0
func Build2DMipmaps(target gl.GLenum, internalFormat gl.GLint, width, height gl.GLsizei, format, kind gl.GLenum, data unsafe.Pointer) gl.GLint {
	return gl.GLint(C.gluBuild2DMipmaps(
		C.GLenum(target),
		C.GLint(internalFormat),
		C.GLsizei(width),
		C.GLsizei(height),
		C.GLenum(format),
		C.GLenum(kind),
		data,
	))
}