Difference between revisions of "love.graphics.newPixelEffect"
m (info for "effect" function) |
(Better (?) explanation of the effect code) |
||
Line 13: | Line 13: | ||
=== Returns === | === Returns === | ||
{{param|PixelEffect|pixeleffect|A PixelEffect object for use in drawing operations.}} | {{param|PixelEffect|pixeleffect|A PixelEffect object for use in drawing operations.}} | ||
+ | |||
+ | == Effect Language == | ||
+ | Pixel effects are not programmed in Lua, but by using a special effect language instead. The effect language is basically [[http://www.opengl.org/sdk/docs/manglsl/|GLSL 1.20]] ([[http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf|specs]]) with a few things renamed: | ||
+ | |||
+ | {| | ||
+ | !GLSL | ||
+ | !Effect language | ||
+ | |- | ||
+ | |float | ||
+ | |number | ||
+ | |- | ||
+ | |sampler2D | ||
+ | |Image | ||
+ | |- | ||
+ | |uniform | ||
+ | |extern | ||
+ | |- | ||
+ | |texture2D(sampler2D tex, vec2 st) | ||
+ | |Texel(Image tex, vec2 st) | ||
+ | |} | ||
== Effect Function == | == Effect Function == | ||
=== Synopsis === | === Synopsis === | ||
<source lang="glsl"> | <source lang="glsl"> | ||
− | vec4 effect( vec4 color, | + | vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param|vec4|color|The color | + | {{param|vec4|color|The drawing color set with [[love.graphics.setColor]].}} |
− | {{param| | + | {{param|Image|texture|The texture of the image or canvas being drawn.}} |
− | {{param|vec2|texture_coords| | + | {{param|vec2|texture_coords|Coordinates of the pixel relative to the texture.}} |
− | {{param|vec2| | + | {{param|vec2|screen_coords|Coordinates of the pixel on the screen.}} |
=== Returns === | === Returns === | ||
− | {{param|vec4|output_color|The color | + | {{param|vec4|output_color|The color of the pixel.}} |
− | |||
== See Also == | == See Also == |
Revision as of 17:08, 1 May 2012
Available since LÖVE 0.8.0 |
This function is not supported in earlier versions. |
Creates a new PixelEffect object for hardware-accelerated pixel level effects.
A PixelEffect contains at least one function, named effect
, which is the effect itself, but it can contain additional functions.
Contents
Function
Synopsis
pixeleffect = love.graphics.newPixelEffect( code )
Arguments
string code
- The pixel effect code.
Returns
PixelEffect pixeleffect
- A PixelEffect object for use in drawing operations.
Effect Language
Pixel effects are not programmed in Lua, but by using a special effect language instead. The effect language is basically [1.20] ([[1]]) with a few things renamed:
GLSL | Effect language |
---|---|
float | number |
sampler2D | Image |
uniform | extern |
texture2D(sampler2D tex, vec2 st) | Texel(Image tex, vec2 st) |
Effect Function
Synopsis
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords )
Arguments
vec4 color
- The drawing color set with love.graphics.setColor.
Image texture
- The texture of the image or canvas being drawn.
vec2 texture_coords
- Coordinates of the pixel relative to the texture.
vec2 screen_coords
- Coordinates of the pixel on the screen.
Returns
vec4 output_color
- The color of the pixel.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info