Пример #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]))
}
Пример #2
0
func GetRenderbufferParameteriv(
	target Enum, pname Enum, params *int32) {
	C.glGetRenderbufferParameteriv(
		C.GLenum(target),
		C.GLenum(pname),
		(*C.GLint)(params))
}
Пример #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))
	}
}
Пример #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]))
}
Пример #5
0
func BlendEquationSeparate(
	modeRGB Enum, modeAlpha Enum) {
	C.glBlendEquationSeparate(
		C.GLenum(modeRGB),
		C.GLenum(modeAlpha))

}
Пример #6
0
func TexParameterf(
	target Enum, pname Enum, param float32) {
	C.glTexParameterf(
		C.GLenum(target),
		C.GLenum(pname),
		C.GLfloat(param))
}
Пример #7
0
func TexParameteriv(
	target Enum, pname Enum, params *int32) {
	C.glTexParameteriv(
		C.GLenum(target),
		C.GLenum(pname),
		(*C.GLint)(params))
}
Пример #8
0
func TexParameterfv(
	target Enum, pname Enum, params *float32) {
	C.glTexParameterfv(
		C.GLenum(target),
		C.GLenum(pname),
		(*C.GLfloat)(params))
}
Пример #9
0
func TexParameteri(
	target Enum, pname Enum, param int32) {
	C.glTexParameteri(
		C.GLenum(target),
		C.GLenum(pname),
		C.GLint(param))
}
Пример #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))
}
Пример #11
0
func StencilOp(
	fail Enum, zfail Enum, zpass Enum) {
	C.glStencilOp(
		C.GLenum(fail),
		C.GLenum(zfail),
		C.GLenum(zpass))
}
Пример #12
0
func BlendFunc(
	sfactor Enum, dfactor Enum) {
	C.glBlendFunc(
		C.GLenum(sfactor),
		C.GLenum(dfactor))

}
Пример #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
}
Пример #14
0
Файл: gl.go Проект: 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)
}
Пример #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))
}
Пример #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))
}
Пример #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

}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))
}
Пример #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))

}
Пример #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))

}
Пример #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))
}
Пример #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))
}
Пример #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,
	))
}