Page 1 of 1
Shaders in 0.8
Posted: Mon Nov 28, 2011 8:23 pm
by The Burrito
In my quest to update In The Dark to 0.8.0 I've run into a snag with shaders.
It looks like everything is good until it tries to send something to the shader.
When I do this:
Code: Select all
lightShader:send("source", sX, (sY-cam.h)*-1)
I get this:
Code: Select all
graphics.lua.1341 : Invalid operation:
- Trying to send the wrong value type to the shader variable, or
- Trying to send array values with wrong dimension, or
- Invalid variable name.
This worked fine before so I guess there was some sort of syntax change somewhere? The fact that it's a vec2 may have something to do with it, sending a single float doesn't seem to cause any issues.
Re: Shaders in 0.8
Posted: Mon Nov 28, 2011 8:28 pm
by bartbes
Have you tried this?
Code: Select all
lightShader:send("source", {sX, (sY-cam.h)*-1})
That is, at least, how I remember it worked.
Re: Shaders in 0.8
Posted: Mon Nov 28, 2011 10:31 pm
by slime
Yeah, the pixeleffect API got changed slightly to allow arrays to be sent. It interprets your current code as an array of floats I think. Bartbes' should work fine if you want a vec2 instead.
Re: Shaders in 0.8
Posted: Mon Nov 28, 2011 11:38 pm
by The Burrito
That worked, thanks guys.
One more thing, is love.graphics.isSupported() the same as love.graphics.hasPixelEffects() ? The latter seems to have been removed.
Re: Shaders in 0.8
Posted: Mon Nov 28, 2011 11:58 pm
by slime
love.graphics.isSupported("pixeleffect") should work.
Re: Shaders in 0.8
Posted: Tue Nov 29, 2011 12:48 am
by The Burrito
ok, Thanks again. now I just need to wrestle with the physics until it stops crashing
Re: Shaders in 0.8
Posted: Wed Nov 30, 2011 2:52 pm
by hughes
have fun... the physics in 0.8.0 is completely different and completely undocumented!
Re: Shaders in 0.8
Posted: Wed Nov 30, 2011 3:09 pm
by vrld
hughes wrote:have fun... the physics in 0.8.0 is updated to the recent box2d version, but yet undocumented (but that's ok, since 0.8 isn't released yet)!
FTFY
Re: Shaders in 0.8
Posted: Wed Nov 30, 2011 3:14 pm
by hughes
hughes wrote:have fun... the physics in 0.8.0 is completely different but the people in irc are very helpful!
FTFM