Difference between revisions of "love.graphics.newPixelEffect"

m
m (info for "effect" function)
Line 1: Line 1:
 
{{newin|[[0.8.0]]|080|type=function}}
 
{{newin|[[0.8.0]]|080|type=function}}
 
Creates a new PixelEffect object for hardware-accelerated pixel level effects.
 
Creates a new PixelEffect object for hardware-accelerated pixel level effects.
 +
 +
A PixelEffect contains at least one function, named <code>effect</code>, which is the effect itself, but it can contain additional functions.
  
 
== Function ==
 
== Function ==
Line 11: 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 Function ==
 +
=== Synopsis ===
 +
<source lang="glsl">
 +
vec4 effect( vec4 color, sampler2D texture, vec2 texture_coords, vec2 pixel_coords )
 +
</source>
 +
=== Arguments ===
 +
{{param|vec4|color|The color of the polygon itself. The same as the last [[love.graphics.setColor]] call}}
 +
{{param|sampler2D|texture|The texture currently used by the polygon, if it has one.}}
 +
{{param|vec2|texture_coords|The current texture coordinates.}}
 +
{{param|vec2|pixel_coords|The current pixel coordinates.}}
 +
=== Returns ===
 +
{{param|vec4|output_color|The color to set the current pixel to.}}
 +
 +
* Note: LÖVE defines the types <code>Image</code> and <code>Texel</code>, which can be used instead of <code>sampler2D</code> and <code>texture2D</code>, respectively.
  
 
== See Also ==
 
== See Also ==

Revision as of 03:37, 31 January 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.

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 Function

Synopsis

vec4 effect( vec4 color, sampler2D texture, vec2 texture_coords, vec2 pixel_coords )

Arguments

vec4 color
The color of the polygon itself. The same as the last love.graphics.setColor call
sampler2D texture
The texture currently used by the polygon, if it has one.
vec2 texture_coords
The current texture coordinates.
vec2 pixel_coords
The current pixel coordinates.

Returns

vec4 output_color
The color to set the current pixel to.
  • Note: LÖVE defines the types Image and Texel, which can be used instead of sampler2D and texture2D, respectively.

See Also

Other Languages