Pixel Effect

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Pixel Effect

Post by raidho36 »

'm not really sure what you mean by this
Shader should alter incoming data rather than generate it. Specifically with löve2d, fragment shader is definitely the wrong place to generate render data. It may be good for some sort of demoscene though, where doing such things is the whole point. But this is not what you do in games.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Pixel Effect

Post by slime »

raidho36 wrote:
'm not really sure what you mean by this
Shader should alter incoming data rather than generate it. Specifically with löve2d, fragment shader is definitely the wrong place to generate render data. It may be good for some sort of demoscene though, where doing such things is the whole point. But this is not what you do in games.
But why? As I said earlier, all a pixel shader does in the first place is generate a color (or a few colors, if you have multiple render targets) based on some code and inputs. You're 'generating data' regardless of what you do.

Now, if you have a very complex / arithmetic-heavy shader you'll likely run into performance problems, and in that case it would be beneficial to move things into textures or uniforms so you can be less ALU-bound, but that's not really related to what you're outputting from the shader.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Pixel Effect

Post by raidho36 »

I propose that doing it by default is the right thing to do.
batatinha
Prole
Posts: 22
Joined: Mon Jun 24, 2013 3:49 am

Re: Pixel Effect

Post by batatinha »

How can i know if the shade code is 1.0, 2.0 or 3.0?
Love recognize if the shader is above the requested version?
User avatar
RedHot
Citizen
Posts: 87
Joined: Mon May 27, 2013 2:43 pm
Location: Poland

Re: Pixel Effect

Post by RedHot »

Love2D is currently stuck with glsl 1.2 (that's OpenGL 2.1). You can recompile it to support other versions.

Glsl 1.2 isn't much but you should be ok with it for starters.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Pixel Effect

Post by slime »

RedHot wrote:Love2D is currently stuck with glsl 1.2 (that's OpenGL 2.1). You can recompile it to support other versions.

Glsl 1.2 isn't much but you should be ok with it for starters.
Well, there are only a few things in pixel shaders you can do in later versions that you can't do with GLSL 1.20 - and many of them also require additional CPU-side OpenGL code. :)

You can overwrite the love.graphics._effectCodeToGLSL function (love.graphics._shaderCodeToGLSL in 0.9.0) in Lua to use a later version, but I don't recommend it. You can also use GLSL extensions such as EXT_gpu_shader4 to enable some additional functionality on systems which support it, but you really need to know what you're doing for that.
Post Reply

Who is online

Users browsing this forum: No registered users and 54 guests