Page 81 of 91
Re: "Questions that don't deserve their own thread" thread
Posted: Mon Nov 21, 2016 3:17 pm
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?
Re: "Questions that don't deserve their own thread" thread
Posted: Mon Nov 21, 2016 3:37 pm
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.
Re: "Questions that don't deserve their own thread" thread
Posted: Mon Nov 21, 2016 4:15 pm
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
Re: "Questions that don't deserve their own thread" thread
Posted: Mon Nov 21, 2016 5:35 pm
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.
Re: "Questions that don't deserve their own thread" thread
Posted: Mon Nov 21, 2016 9:20 pm
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.
Re: "Questions that don't deserve their own thread" thread
Posted: Mon Nov 21, 2016 11:30 pm
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?
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Nov 22, 2016 12:44 am
by slime
There is only a single OpenGL context. Multi-context OpenGL is kind of a mess.
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Nov 22, 2016 1:34 am
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.
Re: "Questions that don't deserve their own thread" thread
Posted: Tue Nov 22, 2016 11:19 am
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
Re: "Questions that don't deserve their own thread" thread
Posted: Wed Nov 23, 2016 7:46 pm
by Le_juiceBOX
What are the advantages and disadvantages for using canvases?