Exemple #1
0
// LoadMemoryTexture2D reads an image from the memory buffer specified by the
// parameter data and uploads the image to OpenG texture memory (using the
// glTexImage2D function).
//
// Note: If the glfw.BuildMipmapsBit flag is set, all mipmap levels for the
// loaded texture are generated and uploaded to texture memory.
//
// Note: The read image is always rescaled to the nearest larger power of
// two resolution using bilinear interpolation.
//
// Note: Unless the glfw.OriginUlBit flag is set, the first pixel in img.Data
// is the lower left corner of the image. Otherwise the first pixel is the upper
// left corner.
//
// Note: For single component images (i.e. gray scale), Format is set to
// GL_ALPHA if the glfw.AlphaMapBit flag is set, otherwise Format is set to GL_LUMINANCE.
//
// Note: ReadImage supports the Truevision Targa version 1 file format
// (.TGA). Supported pixel formats are: 8-bit gray scale, 8-bit paletted
// (24/32-bit color), 24-bit true color and 32-bit true color + alpha.
func LoadMemoryTexture2D(data []byte, flags int) bool {
	if len(data) == 0 {
		return false
	}

	return int(C.glfwLoadMemoryTexture2D(
		unsafe.Pointer(&data[0]), C.long(len(data)), C.int(flags))) == 1
}
Exemple #2
0
func LoadMemoryTexture2D(data []byte, flags int) int {
	return int(C.glfwLoadMemoryTexture2D(unsafe.Pointer(&data), C.long(len(data)), C.int(flags)))
}