rogerlevy
Posts: 4
Joined: Mon Dec 24, 2012 7:53 pm

Löve2D

Mon Oct 27, 2014 7:16 am

Has anyone had success building löve-experiments on the Pi and using hardware acceleration in Lua/Löve2D?

I have just spent a few hours building SDL2 and trying the "automagic" step in the readme. With the -d option it throws an error about AM_PATH_SDL2 not being found. This is extremely difficult.

User avatar
DougieLawson
Posts: 35350
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Löve2D

Mon Oct 27, 2014 8:23 am

Can you post a link to the stuff you're working from? Most folks won't know what Löve2D is or where to find it.
Note: Having anything remotely humorous in your signature is completely banned on this forum.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

rogerlevy
Posts: 4
Joined: Mon Dec 24, 2012 7:53 pm

Re: Löve2D

Mon Oct 27, 2014 1:22 pm


User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11841
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Löve2D

Mon Oct 27, 2014 1:38 pm

moved to graphics programming

rogerlevy
Posts: 4
Joined: Mon Dec 24, 2012 7:53 pm

Re: Löve2D

Mon Oct 27, 2014 5:39 pm

after building and installing sdl2+dependencies, and libluajit 5.1, i got love-experiments to compile and install. now when i type "love" i get:

Code: Select all

Could not set video mode: Couldn't find matching GLX visual
Error: [string "boot.lua"]:337: Could not set window mode
stack traceback:
	[C]: in function 'assert'
	[string "boot.lua"]:337: in function <[string "boot.lua"]:241>
	[C]: in function 'xpcall'
Could not set video mode: Couldn't find matching GLX visual

cattail
Posts: 6
Joined: Mon Mar 05, 2012 2:18 am

Re: Löve2D

Sat Dec 12, 2015 3:12 pm

As I know, Love2d had a Pi branch called : GLES
Don't know what 1st floor said is the one or a old version of Pi branch.

this link:
https://love2d.org/forums/viewtopic.php ... es#p188728
by bartbes on Sun Aug 30, 2015 1:55 pm
"If you just build a a GLES build of love (so either the GLES branch of 0.9.2 or any recent development version of 0.10.0), with an SDL2 with the rpi driver enabled, you don't need X11 anyway, and you get the benefit of actually running love."

but I don't succeed working on this , from Love2d 0.8 to 0.9.2. If any one build Love 2d 0.9.2 for raspbian, give a deb pakage (link url) is very kind of you .

I want use it's usb joystick api to control game for EDU case for a long time...
Last edited by cattail on Sun Dec 27, 2015 12:46 am, edited 2 times in total.

HeadCase
Posts: 50
Joined: Sat Sep 03, 2011 8:11 am

Re: Löve2D

Sun Dec 13, 2015 2:56 pm

OK, so I can confirm that I have now got the 0.10.0 development branch of Love2d working fully accelerated on the RPi 2 with the latest Raspbian Jessie. It was a nightmare, but it runs (not in X) in GL ES mode full screen accelerated and the Demo (SuperToast) looks absolutely fantastic. The animation is perfectly smooth and the antialiasing is flawless. It is a nice test as it is doing a huge amount of work and not stressing the CPU at all.

The big hurdle was SDL2, as the version in the repositories is not configured to use OpenGl ES. Everything will compile but you just get an error message telling you it can't find graphics drivers. If you run love from inside X, SDL2 will open a simple green text window telling you it can't talk to X and when you click OK it just shuts down. That is sensible, as RPi does not yet have drivers to support accelerated X graphics.

So, here is the epic journey you will need to endure to get SuperToast running. Hopefully it will soon be cleaned up and made into a .deb - it doesn't make much sense to have SDL2 in the repository not able to talk to GLES when the SLD2 developers put this feature in over a year ago.

1. download the love2d 0.10.0 .zip file and extract it to the home directory. Open a terminal window and cd into this rude directory. There is a readme there with details of how to do the install. Preface these commands with sudo.

2. Install all the dependencies. The love2d guide mentions these and you will get a complaint if any are missing. Installl SDL2, even though it needs replacing - so you can get the build working. One tricky problem is an error from the configure script about AM_SILENT_RULES. You need to install libtool - Generic library support, which probably should be a default but isn't.

3. Older builds of love2d used to install the final binary for you. These unstable src packages result in a script called love in the repository/src directory, which has some notes saying don't move it. Also, the first time you run it, use sudo or it will complain. This may be obvious to many people, but little gotchas like this can really create confusion when lots of things aren't working properly.

OK, so at this stage, we have no accelerated graphics. What is required is to install a version of SDL2 that actually will use OpenGl ES. I tried various things

- download the latest SDL2 source and build that. Nope, no dice.

- https://solarianprogrammer.com/2015/01/ ... ted-sdl-2/
This looked like it would be the solution, but if it worked for wheezy, it does not seem to work for jessie. Still no dice.

- SDL2 has nightly binaries for RPi version of SDL2. They do not seem to work either.

Actually at this stage I was almost ready to throw in the towel, but a search on the forums turned up this -
viewtopic.php?f=67&t=122525&p=827493&hilit=sdl2#p827493 RetroPi.

Finally, this works. I don't know what they do or why it works, but download that source and do as instructed and you will get an SDL2 that talks to GLES. Supertoast will burst into life on your screen in full screen accelerated glory. To run it get a text window up by ALT-CTL-F2, cd to the rude/src directory and ./love

Unfortunately there is a catch with the SuperToast demo. It seems that the ESC key is not made available to exit, so once the demo is running you can't stop it and it has grabbed all your keys, so power switch is the only way out. The mouse works, so unless retropi has configured SDL2 to ignore keystrokes, ESC must not be being used to exit the demo.

The love2d toolset is unbelievably good and an excellent match to the RPi. It should even run easily on the RPi Zero. Hopefully someone who knows their way around Raspbian can make it a bit easier to get the SDL2 working.

cattail
Posts: 6
Joined: Mon Mar 05, 2012 2:18 am

Re: Löve2D

Sat Dec 26, 2015 12:59 pm

Great job.
From Love2D forum,i found this:
LÖVE 0.9.2 Released
https://love2d.org/forums/viewtopic.php ... ES#p187407

by Nixola on Tue Aug 04, 2015 1:42 pm
If you wish, you can run 0.9.2 on the RPI already! This branch adds GLES support and I am running it on my own pi (even though it has an issue I don't yet understand), and you can also build LÖVE 0.10.0 in its current development state.
(EDIT: you'll need libgles2-mesa-dev for 0.9.2 and gcc-4.8 for 0.10.0)

by bartbes on Tue Aug 04, 2015 4:37 pm
I'm fairly sure raspbian only has gcc-4.6 and gcc-4.8 in the repos, not 4.7.

I'm not sure if the repos have 4.7, but I'm sure they have 4.6 and 4.8 and I also guess 4.8 would be better than 4.7 anyway, so that's why I suggested it.
Little sidenote: I couldn't get raspbian to automatically "set" the gcc and g++ commands to use gcc-4.8 and g++-4.8, I had to create a symlink in /usr/bin myself after installing gcc-4.8 and g++-4.8 and removing the 4.6 versions.


My question is : what version of GCC are you used in rsapbian?
Is libgles2-mesa-dev in your raspbian Jessie or apt-get it?

BTW: Love 2d 0.10.0 final official is out in holiday a few days ago.

cattail
Posts: 6
Joined: Mon Mar 05, 2012 2:18 am

Re: Löve2D

Sat Dec 26, 2015 1:14 pm

Raspberry Pi
https://love2d.org/forums/viewtopic.php ... ES#p188728
by slime on Tue Mar 17, 2015 5:56 pm
SDL2 does have an official VideoCore backend for Raspberry Pi now, since version 2.0.1. You might need to explicitly enable it when building SDL, or explicitly disable the X11 backend – I don't know much about the process of getting it working.

So the right SDL2 build is for VideoCore backend right? The official SDL 2.0.3 has some problum to build for VideoCore backend right?(Or this is a configure problum?)

mark.craig
Posts: 1
Joined: Sat Jan 02, 2016 6:24 pm

Re: Löve2D

Sat Jan 02, 2016 7:24 pm

Hey crew, great thread here. I got an RPI2 for Christmas and became interested in getting LOVE 0.10.0 working with hardware acceleration.

As you guys mentioned, the biggest issue is getting the SDL2 library working with OpenGL-ES2. I was able to get LOVE 0.10.0 running on Jessie or Wheezy using the pre-compiled SDL2 .deb packages used by the RetroPie project. Much easier. Here is where I got all of my info (from the RetroPie-Setup project)...

https://github.com/RetroPie/RetroPie-Se ... ry/sdl2.sh

Here are the steps that I used...

Install some dependencies

These dependencies are for building LOVE and SDL2 from source (even though I'm using the pre-compiled SDL2 .deb files), so I may be installing too much...

$ sudo apt-get install build-essential automake libtool libphysfs-dev libsdl-dev libopenal-dev liblua5.1-0-dev libdevil-dev libmodplug-dev libfreetype6-dev libmpg123-dev libvorbis-dev libmng-dev libxpm-dev devscripts debhelper dh-autoreconf libasound2-dev libudev-dev libdbus-1-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxxf86vm-dev

You may need to remove any existing SDL2 libraries and files...

I started with a minimal Jessie raspbian image, so I did not need to do this step. Here is what the RetroPie-Setup project does to remove the existing SDL2 files...

rm -f /usr/local/bin/sdl2-config /usr/local/include/SDL2/SDL.h /usr/local/include/SDL2/SDL_assert.h /usr/local/include/SDL2/SDL_atomic.h /usr/local/include/SDL2/SDL_audio.h /usr/local/include/SDL2/SDL_bits.h /usr/local/include/SDL2/SDL_blendmode.h /usr/local/include/SDL2/SDL_clipboard.h /usr/local/include/SDL2/SDL_cpuinfo.h /usr/local/include/SDL2/SDL_endian.h /usr/local/include/SDL2/SDL_error.h /usr/local/include/SDL2/SDL_events.h /usr/local/include/SDL2/SDL_filesystem.h /usr/local/include/SDL2/SDL_gamecontroller.h /usr/local/include/SDL2/SDL_gesture.h /usr/local/include/SDL2/SDL_haptic.h /usr/local/include/SDL2/SDL_hints.h /usr/local/include/SDL2/SDL_joystick.h /usr/local/include/SDL2/SDL_keyboard.h /usr/local/include/SDL2/SDL_keycode.h /usr/local/include/SDL2/SDL_loadso.h /usr/local/include/SDL2/SDL_log.h /usr/local/include/SDL2/SDL_main.h /usr/local/include/SDL2/SDL_messagebox.h /usr/local/include/SDL2/SDL_mouse.h /usr/local/include/SDL2/SDL_mutex.h /usr/local/include/SDL2/SDL_name.h /usr/local/include/SDL2/SDL_opengl.h /usr/local/include/SDL2/SDL_opengles.h /usr/local/include/SDL2/SDL_opengles2.h /usr/local/include/SDL2/SDL_pixels.h /usr/local/include/SDL2/SDL_platform.h /usr/local/include/SDL2/SDL_power.h /usr/local/include/SDL2/SDL_quit.h /usr/local/include/SDL2/SDL_rect.h /usr/local/include/SDL2/SDL_render.h /usr/local/include/SDL2/SDL_rwops.h /usr/local/include/SDL2/SDL_scancode.h /usr/local/include/SDL2/SDL_shape.h /usr/local/include/SDL2/SDL_stdinc.h /usr/local/include/SDL2/SDL_surface.h /usr/local/include/SDL2/SDL_system.h /usr/local/include/SDL2/SDL_syswm.h /usr/local/include/SDL2/SDL_thread.h /usr/local/include/SDL2/SDL_timer.h /usr/local/include/SDL2/SDL_touch.h /usr/local/include/SDL2/SDL_types.h /usr/local/include/SDL2/SDL_version.h /usr/local/include/SDL2/SDL_video.h /usr/local/include/SDL2/begin_code.h /usr/local/include/SDL2/close_code.h /usr/local/include/SDL2/SDL_test_assert.h /usr/local/include/SDL2/SDL_test_common.h /usr/local/include/SDL2/SDL_test_compare.h /usr/local/include/SDL2/SDL_test_crc32.h /usr/local/include/SDL2/SDL_test_font.h /usr/local/include/SDL2/SDL_test_fuzzer.h /usr/local/include/SDL2/SDL_test.h /usr/local/include/SDL2/SDL_test_harness.h /usr/local/include/SDL2/SDL_test_images.h /usr/local/include/SDL2/SDL_test_log.h /usr/local/include/SDL2/SDL_test_md5.h /usr/local/include/SDL2/SDL_test_random.h /usr/local/include/SDL2/SDL_config.h /usr/local/include/SDL2/SDL_revision.h /usr/local/lib/libSDL2.la /usr/local/lib/libSDL2.la /usr/local/lib/libSDL2-2.0.so.0.1.0 /usr/local/lib/libSDL2-2.0.so.0 /usr/local/lib/libSDL2.so /usr/local/lib/libSDL2.a /usr/local/lib/libSDL2main.a /usr/local/lib/libSDL2_test.a /usr/local/share/aclocal/sdl2.m4 /usr/local/lib/pkgconfig/sdl2.pc

Download the pre-compiled SDL2 .deb packages for RPI1 or RP2 (Jessie or Wheezy)...


In my case, I downloaded only the Jessie RPI2 .deb packages, but I have included the other available packages (for all combinations of RP1/RPI2 and Jessie/Wheezy)...

Jessie RPI2 packages
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb

Jessie RPI1 packages
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb

Wheezy RPI2 packages
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb

Wheezy RPI1 packages
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb
$ wget http://downloads.petrockblock.com/retro ... _armhf.deb

Install the local .deb packages...

$ sudo dpkg -i libsdl2-2.0-0_2.0.3+1rpi_armhf.deb
$ sudo dpkg -i libsdl2-dev_2.0.3+1rpi_armhf.deb

Download and extract the love-0.10.0 source code for unix...

$ wget https://bitbucket.org/rude/love/downloa ... src.tar.gz
$ tar zxvf love-0.10.0-linux-src.tar.gz

Just configure and compile LOVE as usual...

The configure script already assembled. There is no need to run an automagic script.

$ cd love-0.10.0
$ ./configure
$ make

Run the LOVE super toast splash screen...

$ ./src/love

Building your own SDL2 .deb package...

Also, you can download the SDL2 code and build your own .deb package with this...

$ sudo apt-get install git
$ git clone --branch retropie-2.0.3 https://github.com/RetroPie/SDL-mirror.git sdl2-retropie-2.0.3
$ cd sdl2-retropie-2.0.3
$ dpkg-buildpackage

Any corrections much appreciated. Happy New Year!

Mark

HeadCase
Posts: 50
Joined: Sat Sep 03, 2011 8:11 am

Re: Löve2D

Sun Jan 03, 2016 2:16 am

One of the great things about love2d is luajit. For a little machine like the RPi, the amazing performance of luajit can really make a difference. Based on some quite intensive maths operations, converting lua code (with luajit) to C++ only shows a 25% speed increase. That is quite an impressive result. http://luajit.org/performance_arm.html

The same test done with normal Lua is about 20-30 times slower, and typically python is about 2-3 times slower than normal Lua, so that probably puts Python at something like a 50:1 disadvantage over LuaJIT. If you are feeding a GPU, that can make quite a difference. The secret to LuaJIT speed seems to be in its implementation as a register based virtual machine which runs highly optimised code.

Python is probably still the best language to teach programming, but then to get performance it is only a little sidestep to Lua, as compared to a huge leap to something like C++.

alex5imon
Posts: 1
Joined: Fri Jan 08, 2016 11:44 am

Re: Löve2D

Fri Jan 08, 2016 11:47 am

Hi mark.craig

I've tried your recipe with the following changes:

1) I had to install

Code: Select all

libtheora-dev
as well
2) I had to use

Code: Select all

./configure --with-lua=lua
Everything builds correctly. However when I run the executable I got

Code: Select all

SDL error: Could not get EDL display

skarbat
Posts: 2
Joined: Thu Apr 25, 2013 2:22 am

Re: Löve2D

Mon Jan 11, 2016 9:32 am

I have succeeded in building love2d, following Mark’s steps, and created a bootable image for everyone to share.

* http://pilove.mitako.eu/

Feedback much appreciated - Love2d is really awesome!

Albert

gamecat666
Posts: 14
Joined: Thu Nov 01, 2012 12:59 pm

Re: Löve2D

Thu Jan 14, 2016 9:12 am

just followed mark's guide to get a minimal Jessie version running on a 2gb card. :)
I also had to install libtheora and something else but its quite easy to follow, just keep running ./configure and then installing what it fails on.

(skarbat - i would have used your premade one but didnt have a 4gb card to hand!)

its a shame that its a bit of a faff to get running, as for game programming its probably more accessible to beginners than pygame...?

now, time to find some lua syntax highlighting for nano :)

gamecat666
Posts: 14
Joined: Thu Nov 01, 2012 12:59 pm

Re: Löve2D

Thu Jan 14, 2016 3:47 pm

actually, just quick query - has anyone been able to change the fullscreen resolution in love2d?

love.window.setmode(X,Y) seems to have no effect and it seems to output fullscreen at my max tv resolution (1360, 768), regardless of what i set the framebuffer to in /boot/config.txt

i really want to make a low-res game but cant seem to get it to switch the resolutions.

(edit- nevermind, created a workaround!)
create a low res 'virtual' screen with a canvas. set its filtering mode to 'nearest'
draw all game stuff to there
at the end, draw that canvas (scaled up) to the actual high res screen.
result = low res sharp fat pixels on a high res screen.

grrussel
Posts: 3
Joined: Wed Aug 01, 2012 8:36 pm

Re: Löve2D

Thu Jan 28, 2016 10:21 pm

I have a related issue;

The full screen SDL2+Love with OpenGLES on the PI (so, hardware accelerated) is working fine - except that I have some border of pixels that are not visible on screen e.g. I can not see anything drawn to the left 30pixels, WIDTH-30pixels and the same on top and bottom

The display is an HDMI TV

This problem does not occur in X11 nor at the linux console - there seems to be some difference in handling overdraw when using the native mode directly as done by the SDL2 backend.

Anyone seen this, or have an solution? For now, I simply avoid drawing at the edge of the display...

gamecat666
Posts: 14
Joined: Thu Nov 01, 2012 12:59 pm

Re: Löve2D

Sat Jan 30, 2016 6:49 pm

yeah i have the exact same issue, I ended up rendering to a canvas thats centered in the middle of the actual framebuffer (and then i change the pixel scale to do low res stuff)

any demos ive looked at go off the top left of the screen (and you cant quit them as they dont usually have a way to exit that I can see but thats a different matter)
kind of annoying when trying stuff downloaded from online but the screen and exit issues are pretty easy to code around for personal projects.

HeadCase
Posts: 50
Joined: Sat Sep 03, 2011 8:11 am

Re: Löve2D

Sun Feb 14, 2016 3:41 am

With the new OpenGL drivers in Raspbian, Love2d now installs from the repositories and SDL2 also works directly. If you have installed the GLES SDL2 version you will need to remove that and then installing love2d will pull in the version that works with OpenGL. Also, install PulseAudio or you will get an error message when love2d runs.

Note that the version you will get will be 0.9.1 - quite old, but it does work out of the box. For 0.10.0 it should just be a matter of someone putting together a .deb file.

love2d now works accelerated in an X window - just like on any normal PC. Some initial testing shows off-screen canvas draws blits rotates etc all normal. 0.9.1 is now quite an old version of love, so it would be better to use 0.10.0 to properly test it. Nevertheless most love games and demos should work now with very little effort.

gamecat666
Posts: 14
Joined: Thu Nov 01, 2012 12:59 pm

Re: Löve2D

Sat Feb 27, 2016 10:51 am

i dont know if this is a coincidence or not, but ive just done an apt update/upgrade and now love2d seems to display correctly on my tv when previously it rendered outside the visible area.... maybe the video drivers changed? dunno, but im happy its working properly now. :D

steryo
Posts: 1
Joined: Wed Mar 23, 2016 8:42 pm

Re: Löve2D

Thu Apr 21, 2016 7:56 pm

skarbat wrote:I have succeeded in building love2d, following Mark’s steps, and created a bootable image for everyone to share.

* http://pilove.mitako.eu/

Feedback much appreciated - Love2d is really awesome!

Albert
It really is awesome, thanks to you I've been able to develop a demo and it works like an independent arcade machine for it's own sake. Löve is the perfect fit for Pi imho, easy to build for everyone. Keep up the good work and I'll be following

Vanfanel
Posts: 433
Joined: Sat Aug 18, 2012 5:58 pm

Re: Löve2D

Wed May 18, 2016 7:57 pm

I have LÖVE2D woring great on the Pi2, using the latest hg version. It runs without X11 using SDL2! Awesome!

However, there's this project, Picolove, wich is supposed to be able to load pico-8 games in love:
https://github.com/ftsf/picolove

Has anybody succeeded on making it work on the Pi/Love? How? I have tried loading the different .lua files with love with no luck at all.

Also, what love2d games would you recommend that are freely available and will work with recent love2d on the Pi?

gamecat666
Posts: 14
Joined: Thu Nov 01, 2012 12:59 pm

Re: Löve2D

Wed May 25, 2016 1:14 pm

Vanfanel wrote: However, there's this project, Picolove, wich is supposed to be able to load pico-8 games in love:
https://github.com/ftsf/picolove
I dont know about picoLove, but if its just pico8 stuff you are interested in there is a native port of pico8 for ARM now.
http://www.lexaloffle.com/bbs/?tid=3085

Return to “Graphics programming”