Hello everyone,
I am working on a jam game using Love 0.8.0 and have an issue with PixelEffect. I would really appreciate your help.
I have several shaders that I would like to switch between at run-time, but some of them use uniforms and some of them don't.
If I try to send() the data to a PixelEffect without the uniforms, it throws an error. I can't just declare the uniforms in the shader because they get optimized out.
Is there some way of silencing the error on Love2D's end, or can I trick the GLSL optimiser into leaving the uniforms in?
Thank you,
Saxon
PixelEffect:send() throws error if uniform unused
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 6
- Joined: Sun Nov 11, 2012 2:14 pm
Re: PixelEffect:send() throws error if uniform unused
you'll probably just have to pcall those send callsSaxonDouglass wrote:Hello everyone,
I am working on a jam game using Love 0.8.0 and have an issue with PixelEffect. I would really appreciate your help.
I have several shaders that I would like to switch between at run-time, but some of them use uniforms and some of them don't.
If I try to send() the data to a PixelEffect without the uniforms, it throws an error. I can't just declare the uniforms in the shader because they get optimized out.
Is there some way of silencing the error on Love2D's end, or can I trick the GLSL optimiser into leaving the uniforms in?
Thank you,
Saxon
-
- Prole
- Posts: 6
- Joined: Sun Nov 11, 2012 2:14 pm
Re: PixelEffect:send() throws error if uniform unused
Thank you very much Xgoff, I had forgotten about pcall(). That should do the trick.
Regards,
Saxon
Regards,
Saxon
-
- Prole
- Posts: 6
- Joined: Sun Nov 11, 2012 2:14 pm
Re: PixelEffect:send() throws error if uniform unused
I have been unable to get pcall() to work. I have tried it two different ways, but it still throws an error and blue screens:
Is there any other way I could silence or avoid this error?
Code: Select all
pcall(pixelEffect.send(pixelEffect, "rubyTextureSize", {200, 100}))
Code: Select all
pcall(pixelEffect:send("rubyTextureSize", {200, 100}))
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: PixelEffect:send() throws error if uniform unused
The syntax is:
So in your case:
Code: Select all
pcall(function, param1, param2, ...)
Code: Select all
pcall(pixelEffect.send, pixelEffect, "rubyTextureSize", {200, 100})
When I write def I mean function.
-
- Prole
- Posts: 6
- Joined: Sun Nov 11, 2012 2:14 pm
Re: PixelEffect:send() throws error if uniform unused
Thank you very much kikito, that works.
I'll make sure to double-check the syntax in future.
I'll make sure to double-check the syntax in future.
Who is online
Users browsing this forum: Bing [Bot] and 8 guests