Page 1 of 2
On Android, love.graphics.print() just shows black blocks
Posted: Wed Dec 23, 2015 9:32 pm
by greg.johnson
I run the following tiny program on Android:
function love.load()
font = love.graphics.newFont(36)
love.graphics.setFont(font)
end
function love.draw()
love.graphics.setBackgroundColor(120,120,120)
love.graphics.print("Hello World!", 400, 300)
end
The above works fine if I run it on my linux development box.
But with 0.10.0 on Android, I just get black blocks, the right size for each of the characters in the string I am printing.
Has anyone seen this? Do you know how I can fix it?
Thanks!
Greg Johnson
Re: On Android, love.graphics.print() just shows black block
Posted: Wed Dec 23, 2015 10:06 pm
by bobbyjones
What device are testing on? Maybe if it's too old it would have issues.
Re: On Android, love.graphics.print() just shows black block
Posted: Wed Dec 23, 2015 10:21 pm
by greg.johnson
It is a Samsung Galaxy Tab4 tablet, running Android 4.4.2. I just bought it about a month ago.
Thanks,
Greg J.
Re: On Android, love.graphics.print() just shows black block
Posted: Wed Dec 23, 2015 11:20 pm
by slime
Weird, it shouldn't be doing that.
If you run this instead, does it output pure white blocks instead of black blocks? (Trying to narrow down where the problem might be):
Code: Select all
function love.load()
font = love.graphics.setNewFont(36)
shader = love.graphics.newShader[[
vec4 effect(vec4 color, Image tex, vec2 texcoord, vec2 pixcoord)
{
return vec4(1.0);
}
]]
end
function love.draw()
love.graphics.setBackgroundColor(120,120,120)
love.graphics.setShader(shader)
love.graphics.print("Hello World!", 400, 300)
end
Does it draw regular images fine? e.g. this code should make it display a blue gradient at the top-left of the screen:
Code: Select all
imagedata = love.image.newImageData(256, 256)
imagedata:mapPixel(function(x, y, r, g, b, a)
return x, 0, 0, 255
end)
image = love.graphics.newImage(imagedata)
function love.draw()
love.graphics.draw(image, 0, 0)
end
Re: On Android, love.graphics.print() just shows black block
Posted: Thu Dec 24, 2015 6:40 am
by greg.johnson
Your first test program generates all white boxes.
Your second test program just gives a black screen.
I did an experiment with .png images also. Grabbed a png of Walter White
and wrote a tiny sample program to load and display it. The program worked fine on my linux development box, but just gave a black screen with no visible image on the Android.
Greg
Re: On Android, love.graphics.print() just shows black block
Posted: Thu Dec 24, 2015 2:43 pm
by slime
It seems images either aren't loading or aren't drawing properly – it could be a video driver bug. Do other non-LÖVE games run fine on your device?
Can you run this and paste the output? See here for getting print output on Android:
https://bitbucket.org/MartinFelis/love- ... iki/Logcat
Code: Select all
print("Renderer info: ", love.graphics.getRendererInfo())
print("\nCanvas formats:")
for k,v in pairs(love.graphics.getCanvasFormats()) do
print(k.." supported? "..tostring(v))
end
Re: On Android, love.graphics.print() just shows black block
Posted: Thu Dec 24, 2015 7:16 pm
by greg.johnson
Here is the output of the program:
Code: Select all
adb logcat | \fgrep LOVE
I/SDL/APP ( 6797): [LOVE] Renderer info: OpenGL ES OpenGL ES 2.0 Vivante Corporation Vivante GC1000
I/SDL/APP ( 6797): [LOVE]
I/SDL/APP ( 6797): [LOVE] rgb10a2 supported? false
I/SDL/APP ( 6797): [LOVE] r32f supported? false
I/SDL/APP ( 6797): [LOVE] rgba4 supported? true
I/SDL/APP ( 6797): [LOVE] r16f supported? false
I/SDL/APP ( 6797): [LOVE] r8 supported? false
I/SDL/APP ( 6797): [LOVE] rg32f supported? false
I/SDL/APP ( 6797): [LOVE] rgba32f supported? false
I/SDL/APP ( 6797): [LOVE] rgba8 supported? true
I/SDL/APP ( 6797): [LOVE] rgb565 supported? true
I/SDL/APP ( 6797): [LOVE] normal supported? true
I/SDL/APP ( 6797): [LOVE] rgba16f supported? false
I/SDL/APP ( 6797): [LOVE] rg16f supported? false
I/SDL/APP ( 6797): [LOVE] rgb5a1 supported? true
I/SDL/APP ( 6797): [LOVE] hdr supported? false
I/SDL/APP ( 6797): [LOVE] rg8 supported? false
I/SDL/APP ( 6797): [LOVE] srgb supported? false
I/SDL/APP ( 6797): [LOVE] rg11b10f supported? false
All of those "false" entries probably explain a lot! I downloaded the love android source and have an Android SDK set up on my linux machine. If you want to suggest a patch or a place to look in the love android source code, I'd be happy to update, rebuild, and let you know how that goes.
Possible explanation????? The love Android code needs to do the query of the system it is running on similar to what you did above (but presumably in java), and then configure the love APK to use one of the available ones.
Thanks a million,
Greg Johnson
Re: On Android, love.graphics.print() just shows black block
Posted: Thu Dec 24, 2015 7:25 pm
by slime
greg.johnson wrote:All of those "false" entries probably explain a lot! I downloaded the love android source and have an Android SDK set up on my linux machine. If you want to suggest a patch or a place to look in the love android source code, I'd be happy to update, rebuild, and let you know how that goes.
It's actually to be expected – there are a fair amount of Canvas formats with niche uses which are only supported by a small amount of mobile devices.
Unfortunately I still don't know what the problem could be beyond 'graphics driver bug related to textures'.
Out of curiosity, does this work? It should display two untextured dark green circles.
Code: Select all
shader = love.graphics.newShader[[
vec4 effect(vec4 color, Image tex, vec2 texcoord, vec2 pixcoord)
{
return color;
}
]]
function love.draw()
love.graphics.setColor(0, 255, 0, 128)
love.graphics.setShader(shader)
love.graphics.circle("fill", 100, 100, 100)
love.graphics.setShader()
love.graphics.circle("fill", 200, 100, 100)
end
Re: On Android, love.graphics.print() just shows black block
Posted: Thu Dec 24, 2015 7:49 pm
by greg.johnson
The program shows a single green circle, not two circles. The overlap region of the two circles is a darker green.
I ran the same program on my linux box and it looked different. On linux, there were two dark green circles,
with a light green overlap.
Re: On Android, love.graphics.print() just shows black block
Posted: Thu Dec 24, 2015 8:36 pm
by slime
So textures just aren't working (the rightmost circle actually samples from a 1x1 white texture). Do other non-LÖVE games run fine? If it is a driver bug (which seems very likely), updating your Android version could fix it if it includes updated graphics drivers.