love.graphics.point() and similar after relaunch

Create issue
Issue #92 resolved
Former user created an issue

When launching apk with own game.love everything goes fine, then when exiting (with the usual love.event.quit() ) and re-launching the apk, it won't draw lines, poligons and points.

function love.load()
  text = "test"
end

function love.draw()
  love.graphics.print(text,20,20)
  love.graphics.setPointSize(40,40)
  love.graphics.point(60,60)
end

function love.keypressed(key)
  if key == "escape" then
    love.event.quit()
  end
end

text printing is ok (as drawing image, playing sounds and so on) but not that love.graphics.point(60,60)

Comments (16)

  1. igor cristoni

    Putting an os.exit() instead of a love.event.quit() in love.keypressed(key) with key == "escape" (or whenever exiting the game) seems to fix everything.

  2. Martin Felis repo owner

    Calling os.exit() causes the LÖVE thread to quit and the App to crash (but it only looks like a regular quit). A restart then initializes the GL context anew and therefore works.

    Unfortunately I cannot reproduce the problem as it works on my device (Nexus 4, Android 5.0.1). Nevertheless could you test whether you can reproduce the problem with the attached draw_and_quit.love?

    Also I have just uploaded a new build https://bitbucket.org/MartinFelis/love-android-sdl2/downloads/LOVE_for_android_nightly_2015-01-16_fd9e975.apk. Would be great if you could give it a try.

  3. David Loomis

    This is an issue for me on DROID3 2.3 with the 2015-01-16 nightly. Exiting with os.exit(0) and restarting the program seems to work. edit: sliding the keyboard open and closed seems to cause this! It blanks the screen out momentarily, and then these calls stop drawing (although fps suggests they're still trying to draw)

  4. igor cristoni

    The draw_and_quit.love does work with the nighly and a nexus7 with a fresh android 5 update, launching the .love directly. The same build and device faults with the sample code in the first message, put in sdcard/lovegame. I'll do some other tries soon (eg. putting the draw and quit code in sdcard/lovegame and making a .love out of the other sample code, as well as trying with some other android devices.) Could it be a matter of where the code is, too?

  5. Martin Felis repo owner

    @daveloomis The os.exit(0) will probably always work, but it really should be a matter of last resort. Are you saying the problem occurs also when sliding the keyboard out and in or only when sliding it out and in?

    @igorcristoni No, it should not matter where the code is.

  6. igor cristoni

    Hi...same result with the nightly and an asus TF101 with android 4.0.3 (working draw and quit, issues with drawing point with the code above in sdcard/lovegame). It crashes when pressing home key on the TF101, but indeed this device crashes on almost everyting so not much an issue.

    No issue at all with the LOVE_for_android_0.9.1b.apk from the download page (well, except crashing on TF101 and home key). Or maybe is it silently crashing a-la os.exit()? Hope this could help...

  7. Alex Szpakowski

    I think I tracked the issue down: the graphics module leaves some global state around and doesn't properly reinitialize it when the module starts up or shuts down, so when the graphics module starts up again without the entire program shutting down (i.e. without os.exit), it's reusing some bad state values.

    I believe I fixed the issue in the mobile-common branch of love, so once that gets merged into this repository it should hopefully be fixed. I haven't been able to actually test it myself though.

  8. Martin Felis repo owner

    Latest code and nightly contains current code. Would be great if you could test it.

  9. David Loomis

    I believe changing the keyboard state causes it, this is running it from sd-card/lovegame I have not tried the other file.

  10. igor cristoni

    minimal code in sdcard and launchind draw_and_quit.love works perfectly with the last nightly on the TF101. Will check with other devices and codes in the next days.

  11. igor cristoni

    Hi there! Only on a samsung galaxy young (not sure what is the name outside of italy) and on a 2012 nexus 7. No issues at all. I'm moving to the 9.2 version, tought, i'll let you know. Sorry for not having answered but i've been busy elsewhere (aaaw).

    --

    Igor Cristoni Mozart SpA C.so Garibaldi, 2 20121 Milano (Italy)

  12. Log in to comment