"Questions that don't deserve their own thread" thread

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.
Locked
User avatar
Smoggert
Prole
Posts: 29
Joined: Thu Nov 10, 2016 11:23 pm

Re: "Questions that don't deserve their own thread" thread

Post by Smoggert »

Is it possible to make some sort off loadDraw() function? Where you basically just draw all your canvases that wont change during the game (like game terrain) once. (as calling the graphics module during load does not work :< )

After which u just always call your canvas in the regular draw function? Or do I go about it by overwriting the draw function after 1 cycle or something similar?
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by s-ol »

Smoggert wrote:Is it possible to make some sort off loadDraw() function? Where you basically just draw all your canvases that wont change during the game (like game terrain) once. (as calling the graphics module during load does not work :< )

After which u just always call your canvas in the regular draw function? Or do I go about it by overwriting the draw function after 1 cycle or something similar?
just do it somewhere. wherever you want. You can do it in love.load, in the first call to love.update, in the first call to love.draw, every frame (don't actually do this), even anywhere else in your main.lua or files that you require.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Smoggert
Prole
Posts: 29
Joined: Thu Nov 10, 2016 11:23 pm

Re: "Questions that don't deserve their own thread" thread

Post by Smoggert »

s-ol wrote:
Smoggert wrote:Is it possible to make some sort off loadDraw() function? Where you basically just draw all your canvases that wont change during the game (like game terrain) once. (as calling the graphics module during load does not work :< )

After which u just always call your canvas in the regular draw function? Or do I go about it by overwriting the draw function after 1 cycle or something similar?
just do it somewhere. wherever you want. You can do it in love.load, in the first call to love.update, in the first call to love.draw, every frame (don't actually do this), even anywhere else in your main.lua or files that you require.

O, I was for some reason under the impression that graphics calls didn't work outside of love.draw()
But it was probably something I just did wrong in the past.

Thanks
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by s-ol »

Smoggert wrote:
s-ol wrote:

O, I was for some reason under the impression that graphics calls didn't work outside of love.draw()
But it was probably something I just did wrong in the past.

Thanks
The only limitation there is afaik is that graphics functions don't work (or at least are extremely likely to break stuff) outside of the main thread.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
pgimeno
Party member
Posts: 3550
Joined: Sun Oct 18, 2015 2:58 pm

Re: "Questions that don't deserve their own thread" thread

Post by pgimeno »

The whole screen needs to be redrawn every frame, otherwise when you move away a window that covers the LÖVE window, it doesn't repaint. You can't just draw once and expect it to persist.

Drawing to the screen doesn't work outside love.draw because the default love.run clears the screen right before calling love.draw, erasing anything that was drawn before. The reason why it's cleared every frame is the above.
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: "Questions that don't deserve their own thread" thread

Post by parallax7d »

Does Love use just 1 OpenGL context or multiple? When we feed in our own shaders are these all put into the same context as the main Love context?
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by slime »

There is only a single OpenGL context. Multi-context OpenGL is kind of a mess.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: "Questions that don't deserve their own thread" thread

Post by s-ol »

pgimeno wrote:The whole screen needs to be redrawn every frame, otherwise when you move away a window that covers the LÖVE window, it doesn't repaint. You can't just draw once and expect it to persist.

Drawing to the screen doesn't work outside love.draw because the default love.run clears the screen right before calling love.draw, erasing anything that was drawn before. The reason why it's cleared every frame is the above.
He was talking about drawing static parts to canvases, then drawing them as quads unless I am the one who misunderstood.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Smoggert
Prole
Posts: 29
Joined: Thu Nov 10, 2016 11:23 pm

Re: "Questions that don't deserve their own thread" thread

Post by Smoggert »

s-ol wrote:He was talking about drawing static parts to canvases, then drawing them as quads unless I am the one who misunderstood.
Exactly :)
User avatar
Le_juiceBOX
Citizen
Posts: 71
Joined: Sat Mar 26, 2016 3:07 pm

Re: "Questions that don't deserve their own thread" thread

Post by Le_juiceBOX »

What are the advantages and disadvantages for using canvases?
SteamLibrary-like Program For Love2D Games:
take me to the forum thread!
Locked

Who is online

Users browsing this forum: No registered users and 241 guests