Beispiel #1
0
func CreateFrameBuffer(width, height int, format TextureFormat, flags TextureFlags) FrameBuffer {
	h := C.bgfx_create_frame_buffer(
		C.uint16_t(width),
		C.uint16_t(height),
		C.bgfx_texture_format_t(format),
		C.uint32_t(flags),
	)
	return FrameBuffer{h: h}
}
Beispiel #2
0
func CalcTextureSize(width, height, depth, numMips int, format TextureFormat) TextureInfo {
	var ti C.bgfx_texture_info_t
	C.bgfx_calc_texture_size(
		&ti,
		C.uint16_t(width),
		C.uint16_t(height),
		C.uint16_t(depth),
		C.uint8_t(numMips),
		C.bgfx_texture_format_t(format),
	)
	return newTextureInfo(ti)
}
Beispiel #3
0
func CreateTextureCube(size, numMips int, format TextureFormat, flags TextureFlags, data []byte) Texture {
	var mem *C.bgfx_memory_t
	if data != nil {
		mem = C.bgfx_copy(unsafe.Pointer(&data[0]), C.uint32_t(len(data)))
	}
	h := C.bgfx_create_texture_cube(
		C.uint16_t(size),
		C.uint8_t(numMips),
		C.bgfx_texture_format_t(format),
		C.uint32_t(flags),
		mem,
	)
	return Texture{h: h}
}
Beispiel #4
0
func CreateTexture3D(width, height, depth, numMips int, format TextureFormat, flags TextureFlags, data []byte) Texture {
	var mem *C.bgfx_memory_t
	if data != nil {
		mem = C.bgfx_copy(unsafe.Pointer(&data[0]), C.uint32_t(len(data)))
	}
	h := C.bgfx_create_texture_3d(
		C.uint16_t(width),
		C.uint16_t(height),
		C.uint16_t(depth),
		C.uint8_t(numMips),
		C.bgfx_texture_format_t(format),
		C.uint32_t(flags),
		mem,
	)
	return Texture{h: h}
}