What can cause love2d not to draw

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Gunroar:Cannon()
Party member
Posts: 1143
Joined: Thu Dec 10, 2020 1:57 am

What can cause love2d not to draw

Post 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).
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: What can cause love2d not to draw

Post 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.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: What can cause love2d not to draw

Post 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.
User avatar
Gunroar:Cannon()
Party member
Posts: 1143
Joined: Thu Dec 10, 2020 1:57 am

Re: What can cause love2d not to draw

Post 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).
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
darkfrei
Party member
Posts: 1204
Joined: Sat Feb 08, 2020 11:09 pm

Re: What can cause love2d not to draw

Post by darkfrei »

Please attach the minimal code example .love file with the issue.
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: What can cause love2d not to draw

Post 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>
User avatar
Gunroar:Cannon()
Party member
Posts: 1143
Joined: Thu Dec 10, 2020 1:57 am

Re: What can cause love2d not to draw

Post 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.
Attachments
lovegame.love
(605.05 KiB) Downloaded 89 times
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: What can cause love2d not to draw

Post 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.
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: What can cause love2d not to draw

Post by pgimeno »

I can't reproduce it either.
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: What can cause love2d not to draw

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests