love
love copied to clipboard
love.graphics. print() not printing anything
So I am just just starting out with Love2d and I wrote two lines of code to print a statement using love.graphics.draw(). The moment I run it all I get is a blank screen. Please help me out.
function love.draw()
love.graphics.print("Hello world")
end
A few questions:
-
Which version of love are you using?
-
If you run the no-game screen, does that appear as expected (it should look like this https://love2d.org/w/images/9/9b/11.0-NoGame.png if love 11 is being used) or is it blank as well?
-
What OS and graphics card are you using? Are there any updated graphics drivers compared to what you have installed on your system?
-
I am using the latest version of love that is Love 11.3
-
I can see the no game screen just fine.
-
My OS is Windows 10 and I have recently updated my graphics driver.
What graphics card are you using?
I have Intel Iris plus Graphics
Try giving 2nd and 3rd parameters with x and y, shouldn't make a difference but just in case!
I have the same problem with AMD ATI Radeon 3000 on Windows 10, text is not rendering at all. Everything works fine on Linux. Though this GPU is so old that it doesn't even meet Windows 10 minimum requirements, so it's no surprise to me.
I have the same problem on Raspberry Pi 4 running Raspbian both with 11.1 and 11.3.
For those of you who are running into this issue, can you run this code and take a screenshot of what the window looks like? It might help narrow down where the problem is:
love.graphics.setBackgroundColor(0.3, 0.3, 0.7)
love.graphics.setNewFont(20)
local shader = love.graphics.newShader[[
vec4 effect(vec4 vcolor, Image tex, vec2 texcoord, vec2 pixcoord) {
return vec4(texcoord, 0.0, 1.0);
}
]]
function love.draw()
love.graphics.setShader(shader)
love.graphics.print("The quick brown fox jumps over the lazy dog", 20, 20)
love.graphics.setShader()
love.graphics.print("The quick brown fox jumps over the lazy dog", 20, 50)
end
Here's what it looks like on my computer:
@slime73 Here's what I'm getting.
@thratkin thanks for testing. Can you paste the output of this? (You'll probably want to run it with lovec.exe
instead of love.exe
so the print call shows up in a command prompt.)
print(love.graphics.getRendererInfo())
@slime73 Here's the output.
OpenGL 3.3.11672 Core Profile Context ATI Technologies Inc. ATI Radeon 3000 Graphics
Thanks. I think the commit I just pushed should work around the issue on your system (you'll be able to grab a build from here in a few minutes: https://ci.appveyor.com/project/AlexSzpakowski/love/builds/34053214/job/y5qisg6nk14905my/artifacts )
That commit only expands a driver bug workaround to more ATI/AMD GPUs, it won't change things for Intel or rpi GPUs – for those cases, the test code and getRendererInfo output might help, and I'd also suggest making sure the graphics drivers you're using are as up to date as possible.
@slime73 Yes, the text is now rendering properly on my system. Great job!
@kgorlovsky @atreyi13 are you able to test with the code and debug output I outlined above (as well as testing a build of the latest 11.4 prerelease / git code, if possible)? I probably won't be able to figure out a workaround for your systems without more info.
@slime73 , not sure what voodoo your commit did, but I'd like to help solve this for even more graphics cards. My test window and output are identical to @thokr 's but this is still currently broken on my machine. What further digging can we do? As @thokr stated already though, we're practically trying to render on toasters so if you can't help I wont be that shocked.
I'd like to help solve this for even more graphics cards. My test window and output are identical to @thokr 's but this is still currently broken on my machine.
So you're using the same GPU as thokr? If not, which GPU is it? Are you testing using a recent prerelease build of 11.4? You can grab one from here https://ci.appveyor.com/project/AlexSzpakowski/love/builds/41943056/job/sy46qxq16vms83xq/artifacts (or from here https://github.com/love2d/love/actions/runs/1597397190#artifacts).
I'm assuming love 11.4 fixed this for you, but if it hasn't please share your love.graphics.getRendererInfo output (like https://github.com/love2d/love/issues/1563#issuecomment-657239612).