Working tiger demo?


16 posts
by ajstarks » Tue Jul 10, 2012 1:43 am
Has anyone managed to get a working tiger demo (see: http://www.khronos.org/registry/vg/ri/openvg-1.1-ri.zip) on the Raspberry Pi?

My goal is to get a GPU-accelerated SVG implementation. Any clues?
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by jamesh » Tue Jul 10, 2012 2:07 am
Tiger demo is on of the standard ones we run of the Videocore, so it definitely works - it may even be supplied in the distro. You'll need to take a look. Dom might be able to give more information.
Volunteer at the Raspberry Pi Foundation, helper at Picademy September, October, November 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 12370
Joined: Sat Jul 30, 2011 7:41 pm
by ajstarks » Thu Jul 12, 2012 12:43 pm
I checked on the wheezy distro, but could not find it.
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by dom » Thu Jul 12, 2012 1:19 pm
We do build it for internal testing, but haven't so far been shipping it.
I had assumed it had some code/assets we couldn't distribute. However looking at the licence file, it looks like it is freely distributable, so I'll look into making our patched version of it available.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4105
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by smithnerd » Thu Jul 12, 2012 5:02 pm
I ported it to my Pi yesterday. It took some effort to understand how to marry the EGL initialisation parts of 'hello_triangle.c' with the windows only parts of the tiger demo 'main.c', but I got there in the end. It seems to render quite quickly at 1280x1024.

I'm sure my efforts won't be as polished as the official test version, so probably best to wait for that...
Posts: 8
Joined: Thu Jun 14, 2012 1:18 pm
by ajstarks » Fri Jul 13, 2012 1:27 am
great, @smithnerd. I previously got everything to compile, but was missing the initialization part. Is your code available?
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by smithnerd » Fri Jul 13, 2012 12:19 pm
Well, I warn you, it's a raw snapshot. A hack on a hack really, and based on skim-reading the Khronos OpenVG reference sheet, not the actual spec. Swap this out for main.c:

http://pastebin.com/raw.php?i=YAcPWmXR

I think I was compiling (on Raspbian) with:

gcc main.c tiger.c -o tiger \
-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads \
-L/opt/vc/lib -lEGL -lGLESv2 -lOpenVG -lbcm_host
Posts: 8
Joined: Thu Jun 14, 2012 1:18 pm
by ajstarks » Fri Jul 13, 2012 11:14 pm
Brilliant! works for me.
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by ajstarks » Sat Jul 14, 2012 12:03 am
Here's an updated main function based on the @smtihnerd's version.
It was size the tiger based on command arguments, and quit then your press [Enter].

int main (int argc, char **argv)
{
int w, h;
bcm_host_init();
memset( state, 0, sizeof( *state ) ); // clear application state
init_ogl(state); // Start OGLES
w = state->screen_width;
h = state->screen_height;
if (argc == 3) {
w = atoi(argv[1]);
h = atoi(argv[2]);
}
tiger = PS_construct(tigerCommands, tigerCommandCount, tigerPoints, tigerPointCount);
render(w, h);
while (getchar() != '\n') {
;
}
exit_func();
return 0;
}

Also, here's the Makefile:


tiger: tiger.o main.o
cc -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads tiger.o main.o -L/opt/vc/lib -lGLESv2 -o tiger
main.o: main.c
cc -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -c main.c
tiger.o: tiger.c
cc -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -c tiger.c

so that you can say:

make && tiger 1024 768
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by mikerr » Sat Jul 21, 2012 9:54 pm
Compiled fine on wheezy too, and here's a video:

http://www.youtube.com/watch?v=34VAez8xC9I
Got a Pi Camera? View it in my android app - Raspicam Remote ! No software required on the pi
User avatar
Posts: 1324
Joined: Thu Jan 12, 2012 12:46 pm
Location: NorthWest, UK
by ajstarks » Fri Jul 27, 2012 4:37 am
See: viewtopic.php?f=69&t=12575 for an example of using OpenVG to draw random shapes.
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by dom » Thu Aug 30, 2012 10:41 am
ajstarks wrote:See: viewtopic.php?f=69&t=12575 for an example of using OpenVG to draw random shapes.

I've added a version of VG tiger demo to /opt/vc/src/hello_pi/hello_tiger in latest firmware.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4105
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by ajstarks » Fri Aug 31, 2012 10:05 pm
note that running this demo may lock up your machine -- you cannot Ctrl-C or ssh back in.
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by dom » Fri Aug 31, 2012 10:34 pm
ajstarks wrote:note that running this demo may lock up your machine -- you cannot Ctrl-C or ssh back in.

Control-c should work fine.

Are you overclocking? What memory split are you on?
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4105
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by ajstarks » Sat Sep 01, 2012 3:46 am
Ctrl-C works fine -- to a point. If you let it run for a while, it will continue to run, and then lock your machine. I'm running 128/128, no overclock.
User avatar
Posts: 86
Joined: Fri Jun 22, 2012 2:14 am
by myzinsky » Sat Dec 08, 2012 8:13 pm
Hi,

im interested to render Sozi presentations on the Pi, will is this approach working for me?

Sozi: http://sozi.baierouge.fr/wiki/en:welcome
Posts: 9
Joined: Fri Jul 27, 2012 9:52 pm