Create maps in LÖVE for Android

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.
User avatar
ATS
Prole
Posts: 20
Joined: Mon Jun 28, 2021 3:25 am
Location: Brazil
Contact:

Re: Create maps in LÖVE for Android

Post by ATS »

I looked at the App that 'Gunroar:Cannon()" mentioned and MY GOD :o ! What a complete App, I believe my problem is solved, thanks to everyone who took the time to help me... you guys are awesome ^^

Code: Select all

-------------------------------
-- i love programming in Lua --
-------------------------------
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Create maps in LÖVE for Android

Post by pgimeno »

Gunroar:Cannon() wrote: Fri Aug 27, 2021 8:51 am But non of the shader libraries can be used...I think. I can't even do simple effects in my attempts :?
Any example?

Most importantly, GLES shaders don't accept integers where floats are expected. That's to say, use e.g. 1.0 instead of 1 if a float is required.
User avatar
darkfrei
Party member
Posts: 1173
Joined: Sat Feb 08, 2020 11:09 pm

Re: Create maps in LÖVE for Android

Post by darkfrei »

pgimeno wrote: Fri Aug 27, 2021 8:06 pm Most importantly, GLES shaders don't accept integers where floats are expected. That's to say, use e.g. 1.0 instead of 1 if a float is required.
And
y = math.floor(x)/1
?
I knew that Lua has difference between 1 and 1.0!
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Create maps in LÖVE for Android

Post by pgimeno »

darkfrei wrote: Sat Aug 28, 2021 2:25 am And
y = math.floor(x)/1
?
I knew that Lua has difference between 1 and 1.0!
In Lua 5.1 and LuaJIT there's no difference: they are just double precision floating point numbers. I was talking about GLSL, the language used to write shaders.

Code: Select all

-- Example: Shader to ignore alpha
local shader = love.graphics.newShader[[
  vec4 effect(vec4 colour, Image tex, vec2 texpos, vec2 scrpos)
  {
    return vec4(Texel(tex, texpos).rgb * colour.rgb, 1); // won't work on most GLES
    return vec4(Texel(tex, texpos).rgb * colour.rgb, 1.0); // should work everywhere
  }
]]
(fixed, thanks grump)
Last edited by pgimeno on Sun Aug 29, 2021 11:48 am, edited 1 time in total.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Create maps in LÖVE for Android

Post by grump »

pgimeno wrote: Sat Aug 28, 2021 11:26 am

Code: Select all

-- Example: Shader to ignore alpha
local shader = love.graphics.newShader[[
  vec4 effect(vec2 colour, Image tex, vec2 texpos, vec2 scrpos)
  {
    return vec4(Texel(tex, texpos).rgb * colour.rgb, 1); // won't work on most GLES
    return vec4(Texel(tex, texpos).rgb * colour.rgb, 1.0); // should work everywhere
  }
]]
<pedantic>Won't work anywhere either way because colour should be vec4.</pedantic>
User avatar
Gunroar:Cannon()
Party member
Posts: 1088
Joined: Thu Dec 10, 2020 1:57 am

Re: Create maps in LÖVE for Android

Post by Gunroar:Cannon() »

pgimeno wrote: Fri Aug 27, 2021 8:06 pm
Any example?

Most importantly, GLES shaders don't accept integers where floats are expected. That's to say, use e.g. 1.0 instead of 1 if a float is required.
I knew the 1 -> 1.0 thing, I triedto fix what I could :rofl: . Lighting libs like lightworld don't work. I got shadöw to work barely tho. And in general I can't really find any resource/tutorial to understand shaders well enough to know what I could use them for :?
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: Create maps in LÖVE for Android

Post by GVovkiv »

general I can't really find any resource/tutorial to understand shaders well enough to know what I could use them for :?
bruh
1st page of google
https://glslsandbox.com/
User avatar
Gunroar:Cannon()
Party member
Posts: 1088
Joined: Thu Dec 10, 2020 1:57 am

Re: Create maps in LÖVE for Android

Post by Gunroar:Cannon() »

That just kinda confuses me, I was talking about tutorials and how/when to use them. I read stuff in tuts-gamedev-something but it just gave really basic stuff that löve already does like drawing pictures. Plus I think uniform(or something like that) doesn't work so pushing variables to shaders on android can't work
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Create maps in LÖVE for Android

Post by pgimeno »

@grump thanks, fixed.

@Gunroar:Cannon() I learnt the basics of shaders with http://blogs.love2d.org/content/beginners-guide-shaders
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: Create maps in LÖVE for Android

Post by GVovkiv »

Gunroar:Cannon() wrote: Sun Aug 29, 2021 10:31 am how/when to use them
Maybe when you need it?
Like, from that site you can see that, with shaders you practically draw anything, with 1 drawback, that shaders like use ALOT of perfomance
So if you need to achieve some effect and you can't do that without shader, then use shader
If you can achieve that without shader and it will take less perfomance, than don't use it
Plus I think uniform(or something like that) doesn't work so pushing variables to
Uh
Then adapt code of pure GLSL to love's
pushing variables to shaders on android can't work
Why?
https://www.love2d.org/wiki/Shader:send
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 79 guests