How to make the same shader as Love2d default one
Posted: Thu Apr 13, 2023 3:46 pm
Good day!
I've noticed that when the default shader is set up using
it's possible to draw both a simple Image love.graphics.newImage and an ArrayImage love.graphics.newArrayImage without any additional code changes.
However, I'm struggling to create the same behavior with my custom shader. I have no problem creating a shader that works with either ArrayImage or a simple Image, but not with both. By "both," I mean not simultaneously, but with one (random) of them at a time, like in my example:
Is it even possible?
Here's the full code attached to illustrate my problem:
I've noticed that when the default shader is set up using
Code: Select all
love.graphics.setShader()
However, I'm struggling to create the same behavior with my custom shader. I have no problem creating a shader that works with either ArrayImage or a simple Image, but not with both. By "both," I mean not simultaneously, but with one (random) of them at a time, like in my example:
Code: Select all
-- This works just fine
love.graphics.setShader()
love.graphics.draw(image, 100, 100)
love.graphics.draw(arrayImage, 300, 100)
-- But this gives an error!
-- love.graphics.setShader(shader)
-- love.graphics.draw(image, 100, 100)
-- love.graphics.draw(arrayImage, 300, 100)
Here's the full code attached to illustrate my problem: