Difference between revisions of "CompressedImageFormat"

m (Clarified note text)
m (Cleaned up the notes text)
Line 10: Line 10:
 
;bc5s: The signed variant of the BC5 format.
 
;bc5s: The signed variant of the BC5 format.
 
== Notes ==
 
== Notes ==
Not all formats are supported in [[Image]]s on all systems, although the DXT formats are nearly ubiquitous. BC4 and BC5 are supported on systems with DX10 / OpenGL 3-capable hardware and drivers. Use [[love.graphics.isSupported]] to check:
+
Not all formats are supported in love.graphics [[Image]]s on all systems, although the DXT formats have close to 100% support. The BC4 and BC5 formats are supported on systems with DirectX 10 / OpenGL 3-capable hardware and drivers. Use [[love.graphics.isSupported]] to check:
 
<source lang="lua">
 
<source lang="lua">
 
if not love.graphics.isSupported("dxt") then
 
if not love.graphics.isSupported("dxt") then
 
     -- Can't load CompressedData with DXT formats into images!
 
     -- Can't load CompressedData with DXT formats into images!
     -- On some Linux systems with Mesa drivers, the user will need to install a "libtxc-dxtn" package due to patent reasons.
+
     -- On some Linux systems with Mesa drivers, the user will need to install a "libtxc-dxtn" package because the DXT (aka S3TC) formats are patented.
 
     -- Support for DXT formats other than on Mesa drivers is pretty much guaranteed.
 
     -- Support for DXT formats other than on Mesa drivers is pretty much guaranteed.
 
end
 
end
Line 20: Line 20:
 
if not love.graphics.isSupported("bc5") then
 
if not love.graphics.isSupported("bc5") then
 
     -- Can't load CompressedData with the BC4 and BC5 formats into images!
 
     -- Can't load CompressedData with the BC4 and BC5 formats into images!
     -- The user likely doesn't have a GPU capable of using them.
+
     -- The user likely doesn't have a video card capable of using them.
 
end
 
end
 
</source>
 
</source>

Revision as of 07:07, 8 October 2013

Available since LÖVE 0.9.0
This enum is not supported in earlier versions.

Compressed image data formats. Here is an overview of many of the formats.

Constants

dxt1
The DXT1 format. RGB data at 4 bits per pixel (compared to 32 bits for ImageData and regular Images.) Suitable for fully opaque images.
dxt3
The DXT3 format. RGBA data at 8 bits per pixel. Smooth variations in opacity do not mix well with this format.
dxt5
The DXT5 format. RGBA data at 8 bits per pixel. Recommended for images with varying opacity.
bc4
The BC4 format (also known as 3Dc+ or ATI1.) Stores just the red channel, at 4 bits per pixel.
bc4s
The signed variant of the BC4 format. Same as above but the pixel values in the texture are in the range of [-1, 1] instead of [0, 1] in shaders.
bc5
The BC5 format (also known as 3Dc or ATI2.) Stores red and green channels at 8 bits per pixel.
bc5s
The signed variant of the BC5 format.

Notes

Not all formats are supported in love.graphics Images on all systems, although the DXT formats have close to 100% support. The BC4 and BC5 formats are supported on systems with DirectX 10 / OpenGL 3-capable hardware and drivers. Use love.graphics.isSupported to check:

if not love.graphics.isSupported("dxt") then
    -- Can't load CompressedData with DXT formats into images!
    -- On some Linux systems with Mesa drivers, the user will need to install a "libtxc-dxtn" package because the DXT (aka S3TC) formats are patented.
    -- Support for DXT formats other than on Mesa drivers is pretty much guaranteed.
end

if not love.graphics.isSupported("bc5") then
    -- Can't load CompressedData with the BC4 and BC5 formats into images!
    -- The user likely doesn't have a video card capable of using them.
end

See Also

Other Languages