Page 1 of 2

What can cause love2d not to draw

Posted: Wed Sep 14, 2022 11:58 am
by Gunroar:Cannon()
I have a project that sometimes when I open it nothing draws, just the background color (checked by having mousepressed change the background color). At first I thought it was project specific, like I made a mistake in how I draw stuff but if an error comes up there's also a chance that it will just show that baby baby blue (which I'm guessing is the background color).

What can cause this? Changing default filters? Shaders?(though I didn't mess with those).

Re: What can cause love2d not to draw

Posted: Wed Sep 14, 2022 1:01 pm
by ReFreezed
Is it just text that don't get drawn, or all graphics? It has happened that text has gotten corrupted for me, but only while I was recording the game with Fraps. It was weird indeed.

Re: What can cause love2d not to draw

Posted: Wed Sep 14, 2022 2:25 pm
by pgimeno
I've experienced some weird behaviour with auto-batching; some missing tiles for example. But nothing so extreme as nothing at all being drawn, like you're describing.

Re: What can cause love2d not to draw

Posted: Wed Sep 14, 2022 2:34 pm
by Gunroar:Cannon()
It's weird because it doesn't happen all the time and seems random. I wasn't going to make a topic because I thought it was too specific to my project and I'll have to work with it but the error screen also being blank really got me puzzled.

Nothing draws. In the error screen it's just the blue background, so no text, and in my game that draws images nothing appears except for the white background. I made it change to black and then zoom out to see whether things were in the wrong position but it shows nothing still (+log output says the position of things I'm drawing is correct, 0x, 0y for example).

Re: What can cause love2d not to draw

Posted: Wed Sep 14, 2022 2:53 pm
by darkfrei
Please attach the minimal code example .love file with the issue.

Re: What can cause love2d not to draw

Posted: Thu Sep 15, 2022 4:17 pm
by pgimeno
I just ran into the empty blue screen myself. It happened while I had a shader active, so that's a possible cause; it looks like Löve is not restoring a clean context for displaying error messages. Sorry, no, the shader was not active; the error happened while compiling the shader.

The cause seems to be that I had set the environment variable LOVE_GRAPHICS_USE_OPENGLES=1. The error was:

Code: Select all

Error: [love "boot.lua"]:282: Cannot compile vertex shader code:
0(105) : error C7506: OpenGL/ES does not define the global function texture3D

stack traceback:
	[love "boot.lua"]:345: in function <[love "boot.lua"]:341>
	[C]: in function 'setMode'
	[love "boot.lua"]:282: in function <[love "boot.lua"]:126>
	[C]: in function 'xpcall'
	[love "boot.lua"]:355: in function <[love "boot.lua"]:348>

Re: What can cause love2d not to draw

Posted: Thu Sep 15, 2022 6:13 pm
by Gunroar:Cannon()
Here's my project, using my notorious coding style. The game starts from deadend/game.lua if that helps. Didn't really want to share the ... messy(?) code but ...

It can take a few runs before it shows a blank white screen (I set the background color to white, if you press the mouse the color becomes black, though you won't be able to tell unless it does the strange phenomenon.

Any key press will toggle zooming in/zooming out of the screen and make the background color change.

Re: What can cause love2d not to draw

Posted: Sat Sep 17, 2022 11:40 am
by ddabrahim
I can not reproduce it on my system but I have also experienced similar, except in my case sprites were not simply just not drawn but they were not initialised at all and for example, collision detection failed too. My solution to that was to move all my initialisation code out of love.load just to the top of the code. I have not experienced this problem since. So in my case it was cause by love.load and I try to avoid using it since.

No idea if it solves your problem but figured it worth sharing, maybe helps.

Re: What can cause love2d not to draw

Posted: Sat Sep 17, 2022 1:04 pm
by pgimeno
I can't reproduce it either.

Re: What can cause love2d not to draw

Posted: Sat Sep 17, 2022 3:52 pm
by slime
Maybe it's a graphics driver problem - what GPU and operating system do you have, and are you using the latest available drivers for your GPU?