The primitives (circle, rectangle, polygon, ...) do not set texture coordinates (they default to zero, I think), so it will end up with the same color for all pixels. Due to some implementation specific detail in LÖVE, it will try to sample from the last image that was drawn. It may be undefined behaviour if no texture is bound.
You could use the screen coordinates instead. Calculate how far away the center is and return the right color for that spot. Note that these coordinates are in [0, screen_width] and [0, screen_height], or the same with the Canvas size if one is set. For the top-left pixel, the value would be its center (0.5, 0.5). If FSAA is activated, it will be somewhere around that.
Also note that the origin of these coordinates for the screen is at the bottom-left and Y positive will be up. Canvases are not affected by this. Older OpenGL versions do not have a setting to change that and a workaround requires precious uniforms.
Shader not applied on small canvas
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Shader not applied on small canvas
Shallow indentations.
Re: Shader not applied on small canvas
remember not all computers have canvas support keep that in mind
-
- Prole
- Posts: 7
- Joined: Sun Apr 07, 2013 2:51 pm
Re: Shader not applied on small canvas
Well, I was hoping to use them to minimize the amount of calculations for some elements like procedurally-generated backgrounds to which shaders have been applied, to avoid re-drawing them for each frame. Is there another way to do this...?jjmafiae wrote:remember not all computers have canvas support keep that in mind
- slime
- Solid Snayke
- Posts: 3175
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Shader not applied on small canvas
Canvases are the best way to do this, I believe. At some point you have to make a choice about minimum system requirements versus using useful game / graphics features.Gan_HOPE326 wrote:Well, I was hoping to use them to minimize the amount of calculations for some elements like procedurally-generated backgrounds to which shaders have been applied, to avoid re-drawing them for each frame. Is there another way to do this...?jjmafiae wrote:remember not all computers have canvas support keep that in mind
Nearly every system except for some extremely low-end old computers (especially old laptops) with Intel GMA or ancient AMD/nvidia cards will support canvases.
Re: Shader not applied on small canvas
I think 0.8 has a software backend for Canvases that's used if the hardware doesn't support it. So it should work on practically every computer. But it's not something you can guarantee.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Shader not applied on small canvas
No, it does not. It only takes what the graphics driver gives. Certain drivers may fall back into software mode for some things (don't think the Canvas is one of them), but that should be very rare.T-Bone wrote:I think 0.8 has a software backend for Canvases that's used if the hardware doesn't support it.
Shallow indentations.
Re: Shader not applied on small canvas
Hm? That's interesting, because in 0.7.2, my Netbook didn't support Framebuffers, but on 0.8.0 Canvases work. And I think I remember reading about some alternative back-end that made that possible. But I guess it was some other change they did that fixed it for me, then.Boolsheet wrote:No, it does not. It only takes what the graphics driver gives. Certain drivers may fall back into software mode for some things (don't think the Canvas is one of them), but that should be very rare.T-Bone wrote:I think 0.8 has a software backend for Canvases that's used if the hardware doesn't support it.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Shader not applied on small canvas
The code did change from 0.7.2 to 0.8.0 and it's possible that your driver reacts more friendly to the newer version. 0.9.0 will cover even more possible OpenGL configurations. They are special cases that needed to be known and have their own Canvas-setup code.
Shallow indentations.
Re: Shader not applied on small canvas
yes i should have mentioned that my badslime wrote:Canvases are the best way to do this, I believe. At some point you have to make a choice about minimum system requirements versus using useful game / graphics features.Gan_HOPE326 wrote:Well, I was hoping to use them to minimize the amount of calculations for some elements like procedurally-generated backgrounds to which shaders have been applied, to avoid re-drawing them for each frame. Is there another way to do this...?jjmafiae wrote:remember not all computers have canvas support keep that in mind
Nearly every system except for some extremely low-end old computers (especially old laptops) with Intel GMA or ancient AMD/nvidia cards will support canvases.
-
- Prole
- Posts: 7
- Joined: Sun Apr 07, 2013 2:51 pm
Re: Shader not applied on small canvas
I see, thanks. I'll decide later then, depending on whatever looks better, since I'm still unsure about using shaders. But I guess I'd be ok with using Canvases: if I didn't, those low end computers would probably STILL have trouble (without Canvas use, even my laptop with an nVidia Geforce GT drops to 20 fps if it has to apply the shader frame by frame).slime wrote:Canvases are the best way to do this, I believe. At some point you have to make a choice about minimum system requirements versus using useful game / graphics features.Gan_HOPE326 wrote:Well, I was hoping to use them to minimize the amount of calculations for some elements like procedurally-generated backgrounds to which shaders have been applied, to avoid re-drawing them for each frame. Is there another way to do this...?jjmafiae wrote:remember not all computers have canvas support keep that in mind
Nearly every system except for some extremely low-end old computers (especially old laptops) with Intel GMA or ancient AMD/nvidia cards will support canvases.
Who is online
Users browsing this forum: Google [Bot] and 6 guests