Shaders in 0.8

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.
Post Reply
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Shaders in 0.8

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Shaders in 0.8

Post 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.
User avatar
slime
Solid Snayke
Posts: 3163
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Shaders in 0.8

Post 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.
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Shaders in 0.8

Post 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.
User avatar
slime
Solid Snayke
Posts: 3163
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Shaders in 0.8

Post by slime »

love.graphics.isSupported("pixeleffect") should work.
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Shaders in 0.8

Post by The Burrito »

ok, Thanks again. now I just need to wrestle with the physics until it stops crashing :P
User avatar
hughes
Prole
Posts: 21
Joined: Fri Oct 28, 2011 3:10 am

Re: Shaders in 0.8

Post by hughes »

have fun... the physics in 0.8.0 is completely different and completely undocumented!
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Shaders in 0.8

Post 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
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
hughes
Prole
Posts: 21
Joined: Fri Oct 28, 2011 3:10 am

Re: Shaders in 0.8

Post by hughes »

hughes wrote:have fun... the physics in 0.8.0 is completely different but the people in irc are very helpful!
FTFM :)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest