Page 1 of 2

SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Mon Dec 14, 2015 10:21 am
by MachineCode
I managed to get the 0.10.0 built and running on a RPi 2 with the new Jessie OS. It was a bit of an ordeal, but it does work great. To be fair, the LÖVE install was not the problem - it works as advertised. The Raspbian has a few missing libraries which caused some confusion, but the real problem was the SDL2.

Raspberry pi (and most ARM computers) have OpenGL ES and do not have drivers to impliment OpenGL accelerated in an X window. Sometimes there is a software layer installed so you get a LÖVE window, but at about 1 fps. Accelerated X drivers are coming I believe - from this guy - https://github.com/anholt/linux/commits ... s-v3d-rpi2

The guys over at SDL actually put GLES support in SDL2 so graphical frameworks like LÖVE would work via GLES. The trick is that you run these outside of the X window manager and they take over the whole screen. That is not well explained, in fact the SDL2 in the RPi repository seems to not be configured for the RPi!

Anyway, I posted a rough guide to getting LÖVE working on the RPi over at raspi forums. I did it twice from blank SD cards to make sure.

https://www.raspberrypi.org/forums/view ... 67&t=90184

Since the supertoast demo opens full screen in GLES mode, you need ESC to close it down. It looks like this is not in the latest version. I tried it on my x86 linux machine and that also has lost the ESC exit from the demo. Is there another way to exit from the demo?

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Mon Dec 14, 2015 5:37 pm
by slime
MachineCode wrote:Since the supertoast demo opens full screen in GLES mode, you need ESC to close it down. It looks like this is not in the latest version. I tried it on my x86 linux machine and that also has lost the ESC exit from the demo. Is there another way to exit from the demo?
I just updated the code so that escape exits it as expected – hopefully that should work for you.

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Mon Dec 14, 2015 11:27 pm
by MachineCode
OK. I downloaded the latest and rebuilt. It now works with the ESC. Thanks for that.

The new demo screen is great. It really does showcase what can be achieved on a little machine like the RPi when you get the GPU working. When I can get hold of a Pi Zero I will try and see how far you can push a $5 computer with this framework.

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Fri Dec 25, 2015 2:50 pm
by cattail
Great job. I have a Pi B+, I want to know if Love 0.10.0 also can use GLES on it .
MachineCode , I have read your post in raspberryPi forum, HeadCase is U ,right? Many thanks for hardly works.
It is now ,holiday , the final Love 0.10.0 is out , will u test it may be something fix or updated when u are free?

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Sat Dec 26, 2015 8:12 am
by MachineCode
Hi. I don't have a B+ at the moment, however when I get a Zero I will try to get that working.

Just work through all the dependencies and try and get it compiled. The only tricky thing you may encounter is getting SDL2 working, although it should be OK as the VideoCore IV is the same. RetroPi is available for the B+ I think, so before you start get that working and you should have a working SDL2 installed. After that it should be pretty straightforward.

The B+ is quite a bit slower than the RPi 2, so you may have to be a bit conservative on loading up the CPU with too much work.

The RPi 2 is actually pretty good, and luajit is an absolute beast for performance. Just to give you an idea, I wrote a 3d vector program that pushes some points out to a unit sphere and does a dot product .... 256 x 256 X 6 X 1000 (400 million). A lot of maths works. Tested on my AMD A10-7850K CPU (3GHz 64bit) it takes 13 seconds. On the RPi2 it takes 145sec. For a 32 bit $35 computer that is not bad! Interestingly, plain lua is 20-30 times slower on both machines. The code translated to C++ showed only a 25% boost in performance over luajit. That is a pretty impressive result for luajit.

Code: Select all


	-- Cube0 : x = 1
	for z=0,255 do
		for y=0,255 do
      p[1] = LAST;
      p[2] = ZERO + y * STEP
      p[3] = ZERO + z * STEP
      if v3tst(p,rnd_vec) then
				hmap_0:add(y,z,delta)
			end
		end
	end


Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Tue Jan 12, 2016 10:08 pm
by albertca
Hi,

I have put together a small compact distro, based on Raspbian Jessie, running Love 0.10.0 for everyone to enjoy.

http://pilove.mitako.eu/

Albert

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Tue Jan 12, 2016 11:03 pm
by slime
Awesome!

However, it should probably use SDL 2.0.4 (released a couple weeks ago), rather than 2.0.3. There were a lot of bugs fixed in 2.0.4 – I believe the screenshot of Super Toast on the webpage looks much darker than it should because of one such bug.


I believe the technical details for the bug are:
The Super Toast code enables gamma correction. Enabling gamma correction involves LÖVE's code requesting a sRGB-conversion-capable window framebuffer from SDL when creating the window.
But SDL's code for asking the system for such a framebuffer was broken on some platforms (ones using EGL for OpenGL contexts) in SDL 2.0.3 – it wouldn't request it from the system, but it would report back success to LÖVE as if it did and the system supported it.
So LÖVE would think gamma correction is supported and enabled when it's not, and do color conversions on some color values incorrectly.

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Wed Jan 20, 2016 8:27 pm
by albertca
Just released PiLove 0.2, comes with SDL 2.0.4.
Runs also really well, but can't notice any major difference in the colors, as you mention, slime.
The sdl build logs effectively talk about the "rpi" video driver, it wasn't there on 2.0.3.

I'd like to get the official touch screen events running, but can't seem to persuade SDL2 well enough via environment variables. It builds correctly using libts, and evtest can read from it via /dev/input/event2. Any suggestions anyone?

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Wed Jan 20, 2016 10:38 pm
by slime
albertca wrote:Runs also really well, but can't notice any major difference in the colors, as you mention, slime.
Hmm. Could you run this conf.lua/main.lua and paste the output?

conf.lua:

Code: Select all

function love.conf(t)
    t.gammacorrect = true
end
And main.lua:

Code: Select all

local output = "gamma correct: %s\nrenderer name: %s\n  version: %s\n  vendor: %s\n  device: %s"
output = output:format(love.graphics.isGammaCorrect(), love.graphics.getRendererInfo())

print(output)

function love.draw()
    love.graphics.print(output, 10, 10)
end

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

Re: SuperToast, RaspberryPi 2 and Raspbian Jessie

Posted: Sat Jan 23, 2016 11:24 am
by bobbyjones
I see on the website that you need help with the audio? I remember setting up my pi I had to force audio through HDMI. It's a setting in the config file.