Hi,
So, I have not really ever programmed any glsl shader, and I saw that Love2D supports them! Making all kinds of cool FX. I really want to learn how to use glsl with Love2D! Can anyone point to the wiki location/demos for programming Love2D with shaders! I really like advice too, because, I have not seen a set example on how to use shaders in Love2D.
Thanks!
Shaders? How Can I Use This COOL THING!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Shaders? How Can I Use This COOL THING!
I write rules for my computer... I'm not the ruler of the world(yet)... Also, I livestream stuff http://NateAGeek.com/Live
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Shaders? How Can I Use This COOL THING!
Look through the old forum posts, and find lots of projects using glsl. (Try a search). Examine what they do, then look at the code. The main thing you need is the effect function. I'm sure you can figure it out To start, take a look at my file Trippy.love, somewhere...
- xXxMoNkEyMaNxXx
- Party member
- Posts: 206
- Joined: Thu Jan 10, 2013 6:16 am
- Location: Canada
Re: Shaders? How Can I Use This COOL THING!
Thank you,xXxMoNkEyMaNxXx wrote:Here:
viewtopic.php?f=4&t=12354
Do you think maybe you could go into detail about the shader
Code: Select all
extern number t;
vec4 effect(vec4 colour, Image img, vec2 txy, vec2 sxy)
{
return vec4(pow(cos(sxy.x/20+t),2),pow(sin(sxy.y/20+t),2),abs(1/(1+tan(length(sxy/20)+t))),1);
}
I write rules for my computer... I'm not the ruler of the world(yet)... Also, I livestream stuff http://NateAGeek.com/Live
Re: Shaders? How Can I Use This COOL THING!
The pixelEffect ( shader ) only applies to things being rendered ( in this case the square )TheP3 wrote:However, how does it know to apply that shader just to the rectangle?
The effect function is called by default onto everything that is rendered on screen ( it will say )TheP3 wrote:Also, you never called or executed effect. How did that get executed? Is it a default for Love2D or something? One last thing, the effect function was not called, so how did it get its arguments for: vec4 colour, Image img, vec2 txy, vec2 sxy?
A pixel with color 1,0,0,1 not part of an image and at coordinates 15,18 will give
{1,0,0,1} as color
nil as image ( I think )
nil as txy ( there's no image so no image coordinates )
{15,18} as sxy
essential part: effect() is called for every pixel rendered in the window
If you can't fix it, Kill it with fire. ( Preferably before it lays eggs. )
Re: Shaders? How Can I Use This COOL THING!
Are there any other shader functions Love2D comes with? Is there a wiki page? I really don't feel like looking through the source... hahaZer0 wrote:The pixelEffect ( shader ) only applies to things being rendered ( in this case the square )TheP3 wrote:However, how does it know to apply that shader just to the rectangle?
The effect function is called by default onto everything that is rendered on screen ( it will say )TheP3 wrote:Also, you never called or executed effect. How did that get executed? Is it a default for Love2D or something? One last thing, the effect function was not called, so how did it get its arguments for: vec4 colour, Image img, vec2 txy, vec2 sxy?
A pixel with color 1,0,0,1 not part of an image and at coordinates 15,18 will give
{1,0,0,1} as color
nil as image ( I think )
nil as txy ( there's no image so no image coordinates )
{15,18} as sxy
essential part: effect() is called for every pixel rendered in the window
I write rules for my computer... I'm not the ruler of the world(yet)... Also, I livestream stuff http://NateAGeek.com/Live
Re: Shaders? How Can I Use This COOL THING!
https://www.love2d.org/wiki/love.graphi ... ixelEffectTheP3 wrote:Are there any other shader functions Love2D comes with? Is there a wiki page? I really don't feel like looking through the source... haha
https://www.love2d.org/wiki/PixelEffect
wiki pages
If you can't fix it, Kill it with fire. ( Preferably before it lays eggs. )
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 7 guests