Is anyone going to be porting SDL 2.0 to Raspberry Pi?
It's near release, as the developers are basically only fixing release critical bugs now, so it would be a perfect time to get started.
SDL is very usable on the Pi, but the standard interfaces aren't acellerated. However for my application, it ported by me simply typing 'make' and worked right away. Yes, it's a little slower than on my desktop, but tht's mostly due to the ARM processor being slower - my application is poking pixels for the most part - although the sprite handler would benefit from some sort of hardwar "blitter" type acelleration as done on some of the early 2D graphics cards...ghans wrote:Is is SDL usable without hardware acceleration on the Pi ? This was a problem
for many people who ported apps , which itself are potable because of
SDL.
ghans
Code: Select all
hg clone http://hg.libsdl.org/SDL
cd SDL
./autogen.sh
wget http://jbeekman.nl/pub/sdl2_video_rpi.tbz
tar xvjf sdl2_video_rpi.tbz
mkdir build
cd build
export CFLAGS="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads"
export LDFLAGS="-L/opt/vc/lib/"
../configure --prefix=`pwd`/install --without-x --disable-video-x11 --disable-x11-shared --disable-video-x11-xcursor --disable-video-x11-xinerama --disable-video-x11-xinput --disable-video-x11-xrandr --disable-video-x11-scrnsaver --disable-video-x11-xshape --disable-video-x11-vm --disable-video-opengl --disable-video-directfb --enable-video-opengles --enable-video-dummy
make
make install
# The binaries and includes are now located in SDL/build/install
Code: Select all
hg clone http://hg.libsdl.org/SDL_image
cd SDL_image
./autogen.sh
mkdir build
cd build
../configure --prefix=`pwd`/../../SDL/build/install
make
make install
# The binaries and includes are now located in SDL/build/install
Code: Select all
hg clone http://hg.libsdl.org/SDL_ttf
cd SDL_ttf
./autogen.sh
mkdir build
cd build
../configure --prefix=`pwd`/../../SDL/build/install --without-x
make
make install
# The binaries and includes are now located in SDL/build/install
Code: Select all
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
int main ()
{
struct termios old_terminal_settings, new_terminal_settings;
//Disable line buffering, read STDIN char by char
tcgetattr(0, &old_terminal_settings);
memcpy(&new_terminal_settings, &old_terminal_settings, sizeof(struct termios));
new_terminal_settings.c_lflag &= ~(ICANON|ECHO);
new_terminal_settings.c_cc[VTIME] = 0;
new_terminal_settings.c_cc[VMIN] = 1;
tcsetattr(0, TCSANOW, &new_terminal_settings);
fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL, 0) | O_NONBLOCK);
//SDL init here
while (!feof(stdin))
{
char ch;
//SDL main loop here
if (EOF!=(ch=getchar()))
{
//interpret ch here
}
else
{
//should check for errno==EAGAIN here, other errors might indicate real EOF
}
}
tcsetattr(0, TCSANOW, &old_terminal_settings);
//SDL finish here
return 0;
}
Thanks to your post, I can build SDL2.0 apps now, but I'm getting intriguing graphics corruption.jethrogb wrote:I've got SDL 2.0 working with hardware acceleration without X. "patch" at http://jbeekman.nl/pub/sdl2_video_rpi.tbz . This is mostly the pandora code with modifications to make it work on the RPi. This is a huge hack, but it works. Events don't work, I'm not sure if I will be implementing those.
Code: Select all
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);