Difference between revisions of "TextureFormat"

(Cleaned up formatting and added some notes)
(Use the feature templates)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{newin|[[0.9.0]]|090|type=enum}}
+
{{newinoldin|[[0.9.0]]|090|[[0.10.0]]|100|type=enum}}
Controls the canvas texture format.
+
[[Image]] texture formats.
 +
 
 +
As of LÖVE [[0.9.2]], [[Canvas]]es use [[CanvasFormat]]s rather than TextureFormats.
 
== Constants ==
 
== Constants ==
 
;normal: The default texture format: 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders.)
 
;normal: The default texture format: 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders.)
;hdr: The high dynamic range texture format: floating point 16 bits per channel (64 bpp) RGBA. Color channel values inside the Canvas range from -infinity to +infinity.
+
;hdr: Only usable in Canvases. The high dynamic range texture format: floating point 16 bits per channel (64 bpp) RGBA. Color channel values inside the Canvas range from -infinity to +infinity.
 +
{{New feature|0.9.1|
 +
;srgb: The same as <code>normal</code>, but the texture is ''interpreted'' as being in the sRGB color space. It will be decoded from sRGB to linear RGB when drawn or sampled from in a shader. For Canvases, this will also convert everything drawn ''to'' the Canvas from linear RGB to sRGB.}}
 
== Notes ==
 
== Notes ==
 
The HDR format is most useful when combined with pixel shaders. Effects such as tonemapped HDR with bloom can be accomplished, or the canvas can be used to store arbitrary non-color data such as positions which are then interpreted and used in a shader, as long as you draw the right things to the canvas.
 
The HDR format is most useful when combined with pixel shaders. Effects such as tonemapped HDR with bloom can be accomplished, or the canvas can be used to store arbitrary non-color data such as positions which are then interpreted and used in a shader, as long as you draw the right things to the canvas.
  
Not all systems which support Canvases will support the HDR format, use [[love.graphics.isSupported]] to check before creating the Canvas.
+
The sRGB format should only be used when doing gamma-correct rendering, which is an advanced topic and it's easy to get color-spaces mixed up. If you're not sure whether you need this, you might want to avoid it. Read more about gamma-correct rendering [http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html here], [http://filmicgames.com/archives/299 here], and [http://renderwonk.com/blog/index.php/archive/adventures-with-gamma-correct-rendering/ here].
 +
 
 +
Not all systems support the HDR and sRGB formats. Use [[love.graphics.isSupported]] to check before creating the Canvas or Image.
 
== See Also ==
 
== See Also ==
 
* [[parent::love.graphics]]
 
* [[parent::love.graphics]]
 +
* [[love.graphics.newImage]]
 
* [[love.graphics.newCanvas]]
 
* [[love.graphics.newCanvas]]
 
* [[love.graphics.isSupported]]
 
* [[love.graphics.isSupported]]
Line 15: Line 22:
 
{{#set:Description=Controls the canvas texture format.}}
 
{{#set:Description=Controls the canvas texture format.}}
 
== Other Languages ==
 
== Other Languages ==
{{i18n|TextureMode}}
+
{{i18n|TextureFormat}}

Latest revision as of 14:48, 16 May 2016

Available since LÖVE 0.9.0 and removed in LÖVE 0.10.0
This enum is not supported in earlier or later versions.

Image texture formats.

As of LÖVE 0.9.2, Canvases use CanvasFormats rather than TextureFormats.

Constants

normal
The default texture format: 8 bits per channel (32 bpp) RGBA. Color channel values range from 0-255 (0-1 in shaders.)
hdr
Only usable in Canvases. The high dynamic range texture format: floating point 16 bits per channel (64 bpp) RGBA. Color channel values inside the Canvas range from -infinity to +infinity.
Available since LÖVE 0.9.1
srgb
The same as normal, but the texture is interpreted as being in the sRGB color space. It will be decoded from sRGB to linear RGB when drawn or sampled from in a shader. For Canvases, this will also convert everything drawn to the Canvas from linear RGB to sRGB.

Notes

The HDR format is most useful when combined with pixel shaders. Effects such as tonemapped HDR with bloom can be accomplished, or the canvas can be used to store arbitrary non-color data such as positions which are then interpreted and used in a shader, as long as you draw the right things to the canvas.

The sRGB format should only be used when doing gamma-correct rendering, which is an advanced topic and it's easy to get color-spaces mixed up. If you're not sure whether you need this, you might want to avoid it. Read more about gamma-correct rendering here, here, and here.

Not all systems support the HDR and sRGB formats. Use love.graphics.isSupported to check before creating the Canvas or Image.

See Also

Other Languages