maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Finally: GL to GLES runtime (glshim from openpandora) (https://talk.maemo.org/showthread.php?t=90922)

AapoRantalainen 2013-08-01 15:21

Finally: GL to GLES runtime (glshim from openpandora)
 
This is developer sneak peak for glshim (https://github.com/lunixbochs/glshim) by lunixbochs.

If you haven't read (open)pandoralive (http://www.pandoralive.info/?p=1533), glshim is runtime translation from GL 1.x to GL ES 1.x which means openGL games can be run with openGLES-hardware (without modifications, just recompilation).

Library is experimental even on Pandora and very experimental for Maemo5, but I think this is the rigth moment to keep noise about it.

Take glshim. Compile glshim under scrathbox. Get libGL.so.1. Compile unmodified GL-game against it *. Copy game and library to the device.
-> profit (check video, Bloboats on n900): http://youtu.be/ZHJ2I8rePmI

* Fix problems. E.g. (bloboats) gluOrtho2D(0, width, 0, height); -> glOrtho(0, width, 0, height,-1.0,1.0);


Issues at this moment (01 Aug 2013):
*sometimes at the start screen is messed (big blocks)
*when screen dims, screen will be messed (big blocks)


Remember: If game is using SDL:
-SDLK_RETURN
+SDLK_RETURN or SDLK_KP_ENTER
(and do something about SDLK_ESCAPE)


Talk on openpandora-forum:
http://boards.openpandora.org/index....dr-more-games/

Talk on rasberry-forum:
http://www.raspberrypi.org/phpBB3/vi...45252&p=395110
-----
EDIT:
You need this for glu-functions:
https://github.com/lunixbochs/glues

Next video: (blending test from nehe) http://youtu.be/lsS8QlO11us

Code:

wget http://nehe.gamedev.net/data/lessons/linuxsdl/lesson08.tar.gz
gcc -Wall -ansi lesson08.c -o lesson08 -lGL -lGLU -lGLUES_CM `sdl-config --cflags --libs`
#where GL and GLU are from glshim
#and GLUES_CM from GLUES


HtheB 2013-08-01 15:50

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Awesome! :D

szopin 2013-08-01 16:29

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
WOW!!! Does this mean finally armagetron on N900? :D Awesome. So many games/progs are now open to porting. YAY!

jessi3k3 2013-08-01 16:42

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
This is awesome! I'll have to compile this in scratchbox and check it out tonight though the idea isn't exactly new. I'm more interested in the performance and compatibility.

DfLo1913 2013-08-01 16:55

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Keep the N900 going

www.rzr.online.fr 2013-08-01 17:28

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
something to rebuild for harmattan too :)

szopin 2013-08-01 18:13

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by jessi3k3 (Post 1364272)
This is awesome! I'll have to compile this in scratchbox and check it out tonight though the idea isn't exactly new. I'm more interested in the performance and compatibility.

Heh, couldn't wait, compiled on-device. GL2 fails, I'm assuming as expected, 'make glu' worked for libGLU.so, then compiled armagetron with newly created .so's in LD_LIBRARY_PATH, sadly getting error trying to run it:
Code:

[3|user@Nokia-N900|~/libs/armagetronad-0.2.8.3.2]./armagetronad_main
Trying to start sound. Just restart Armagetron Advanced in case of crash.
libGL: built on Aug  1 2013 18:59:52
ERROR: EGL Error detected: EGL_BAD_NATIVE_WINDOW (0x300B)
ERROR: EGL Error detected: EGL_BAD_MATCH (0x3009)
Segmentation fault

Would this be glshim error? Sorry for such app-specific question in general glshim thread, but maybe Aapo you've encountered it? Once again THANKS, awesome stuff

AapoRantalainen 2013-08-01 21:54

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
1 Attachment(s)
Quote:

Originally Posted by szopin (Post 1364292)
Heh, couldn't wait, compiled on-device. GL2 fails, I'm assuming as expected,

Yes, https://github.com/lunixbochs/glshim/issues/13

Quote:

Originally Posted by szopin (Post 1364292)
Code:

[3|user@Nokia-N900|~/libs/armagetronad-0.2.8.3.2]./armagetronad_main
Trying to start sound. Just restart Armagetron Advanced in case of crash.
libGL: built on Aug  1 2013 18:59:52
ERROR: EGL Error detected: EGL_BAD_NATIVE_WINDOW (0x300B)
ERROR: EGL Error detected: EGL_BAD_MATCH (0x3009)
Segmentation fault


I see these errors when quitting/ending, https://github.com/lunixbochs/glshim/issues/15

I got armagetron's menus working. Gameplay area is black, but texts top on game are working. (using this https://github.com/lunixbochs/glues and dropping SDL_WM_SetIcon for keyboard focus)

szopin 2013-08-02 03:06

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
The link from 1st post mentions arma as working with screenshot, so I'm hopeful. Time to learn wm_seticons of GL

seanmcken 2013-08-02 03:37

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
**** That N9 And Please Keep Working On N900, Keep it Up Guyssss. Goooood Luckkkkkk, May Gos Bless Ya'll

nokiabot 2013-08-02 04:51

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
keep the ***** on:)

szopin 2013-08-02 09:55

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by AapoRantalainen (Post 1364330)
Yes, https://github.com/lunixbochs/glshim/issues/13


I see these errors when quitting/ending, https://github.com/lunixbochs/glshim/issues/15

I got armagetron's menus working. Gameplay area is black, but texts top on game are working. (using this https://github.com/lunixbochs/glues and dropping SDL_WM_SetIcon for keyboard focus)

Got it working with a bit of playing with folders (unsquashed pnd from pandora, their config file was useful). Textures work, but sadly at 800x480 getting only 4-5 fps (even less on maps with mazes): With ping in the 200s on 3g would be fun. Too bad Jolla is going with wayland, we could use that double-core

EDIT: Thanks freeman, it was indeed mesa GLU (libGLU.so needed '.1') + libGL, with proper GLU (from github glues) getting same black screen in game :( at least the fps are now >40

freemangordon 2013-08-02 10:21

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by szopin (Post 1364414)
Got it working with a bit of playing with folders (unsquashed pnd from pandora, their config file was useful). Textures work, but sadly at 800x480 getting only 4-5 fps (even less on maps with mazes): With ping in the 200s on 3g would be fun. Too bad Jolla is going with wayland, we could use that double-core

Hmm, 4-5 fps is too low IMO, are you sure it is really accelerated? You can grab PVRTrace and PVRTool to trace GL calls and see WTF is going on.

AapoRantalainen 2013-08-03 20:22

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by freemangordon (Post 1364422)
You can grab PVRTrace

Can you very briefly tell what is pvrtrace and where it can be grabbed? Is it used same way as 'trace' i.e. I need arm binary for Maemo5 and put it to the device?

freemangordon 2013-08-03 22:46

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by AapoRantalainen (Post 1364737)
Can you very briefly tell what is pvrtrace and where it can be grabbed? Is it used same way as 'trace' i.e. I need arm binary for Maemo5 and put it to the device?

PVRTrace and PVRTool are part of Imagination's PowerVR SDK:

http://www.imgtec.com/powervr/insider/pvrtrace.asp
http://www.imgtec.com/powervr/inside...vr-pvrtune.asp

Latest versions work pretty much OK with N900, though you'll need recent OpenGL support on your desktop for PVRTrace frame analysis to work(I was unable to do it on my WindowsXP machine).

I use the following pvrtrace.cfg:

Code:

[host]
EglLibraryPath = /usr/lib/libEGL.so
Es1LibraryPath = /usr/lib/libGLES_CM.so
Es2LibraryPath = /usr/lib/libGLESv2.so
[record]
TraceFile = /home/user/MyDocs/tmp/trace-%pid.pvrt
RecordData = 1
StartFrame = 1
EndFrame = 10
;Network = 1
;NetworkSendData = 1

Change EndFrame according to your needs. Also make sure /home/user/MyDocs/tmp dir exists ;)

To capture a trace for a particualr program, copy the libs into the dir the traced binary is, create pvrtrace.cfg in the same dir with the above content and use:
Code:

LD_PRELOAD="./libEGL.so ./libGLESv2.so ./libGLES_CM.so ./libPVRTrace.so" ./$BINARY
On windows the trace libs for N900 are in Imagination\PowerVR\GraphicsSDK\PVRTrace\Recorder\ Linux_armv7, too lazy to power the laptop up to check where are they located no Linux, but I am sure you'll figure it out if needed.

For PVRTune you need to copy PVRPerfServerDeveloper on the device and run it. I found the default data capture period of 5ms(iirc) too low for my needs, so I used 30ms, but I guess it depends on the tuned program(I used it against gecko :) )

All tools that come with the SDK have good documentation, however, if you need any further instructions I'll gladly try to help, just ask.

EDIT:
The above LD_PRELOAD is for GLES2.0, for a different version maybe more or different trace libs need to be loaded.

AapoRantalainen 2013-08-05 22:35

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
I made packages to the extras-devel: libglshim-dev, libglushim-dev, libglshim, libglushim. And they are working as expected!

glshim is https://github.com/lunixbochs/glshim
glushim is https://github.com/lunixbochs/glues/tree/glu (i.e. 'glu' branch in glues, this was cure for black armagetron).

Android_808 2013-08-06 07:01

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
great work. vid of armagetron looks very smooth.

just wondering what other titles we could now try porting?

MartinK 2013-08-06 09:37

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by Android_808 (Post 1365176)
great work. vid of armagetron looks very smooth.

just wondering what other titles we could now try porting?

Frets on fire ? :)

HtheB 2013-08-06 13:54

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Blender? :p

taixzo 2013-08-06 15:29

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by HtheB (Post 1365251)
Blender? :p

Oh, I am hoping for this. Someone made a GL->GLES header file a ways back (4 years ago) and posted a video of Blender running smoothly on the N900...but then it vanished and I could only ever find a software GL version.

Not that Blender would necessarily be useful, but...to be able to say, "well, my phone can run Blender!" is fun. :cool:

guilledoc 2013-08-06 15:46

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
FooBillard?

jessi3k3 2013-08-06 19:07

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by AapoRantalainen (Post 1365139)
I made packages to the extras-devel: libglshim-dev, libglushim-dev, libglshim, libglushim. And they are working as expected!

glshim is https://github.com/lunixbochs/glshim
glushim is https://github.com/lunixbochs/glues/tree/glu (i.e. 'glu' branch in glues, this was cure for black armagetron).

Just curious how you got it compiled? I'm running into the same problem you were having that you linked in one of your previous posts in scratchbox. I haven't had much time to look into it but did you just pull the latest GIT again and it worked?

mankir 2013-08-06 20:36

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by taixzo (Post 1365276)
Oh, I am hoping for this. Someone made a GL->GLES header file a ways back (4 years ago) and posted a video of Blender running smoothly on the N900...but then it vanished and I could only ever find a software GL version.

Not that Blender would necessarily be useful, but...to be able to say, "well, my phone can run Blender!" is fun. :cool:

If Blender would be available on the n900, i would use it as my main phone again and do some modelling on the run!

Android_808 2013-08-06 22:12

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
blender? really? can you really imagine trying to use those menus? bragging only good if you can actually use it.

i was thinking more like porting of gl renderers for emulators, acceleration in app rendering, webgl, classic games (foobilliard, as suggested, if it runs ok would be cool), engines like irrlicht to help with new games.....

MartinK 2013-08-06 22:50

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Its off-topic, but I'll just add that I've managed to start JOSM on N900 once. Not really usable, but it run. :)

AapoRantalainen 2013-08-07 07:13

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Version glishim=0.1-maemo3 (on extras-devel) works with already existing freeglut3 (in this case 'works'='compiles and can executed').

Quote:

Originally Posted by jessi3k3 (Post 1365341)
Just curious how you got it compiled?

In general, load sources from extras and read debian/rules. E.g. apt-get source or using http://maemo.org/packages, in this case: http://repository.maemo.org/extras-d...-maemo3.tar.gz

Trick is not use 'make', but 'make GL', as source contains many targets, but we only need/use GL. Today code on git might compile another targets also.

HtheB 2013-08-07 10:39

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by Android_808 (Post 1365384)
blender? really? can you really imagine trying to use those menus? bragging only good if you can actually use it.

i was thinking more like porting of gl renderers for emulators, acceleration in app rendering, webgl, classic games (foobilliard, as suggested, if it runs ok would be cool), engines like irrlicht to help with new games.....

Thats why the stylus is for eh :D
But remember that you can connect the N900 to the TV with the TV-Out cable (although it wouldn't be 'on the go' anymore)

Here is a video of Blender 2.5 Alpha running on the N900:
http://www.youtube.com/watch?v=SriTyCtY1mE

AapoRantalainen 2013-08-08 07:21

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by freemangordon (Post 1364768)
On windows the trace libs for N900 are in Imagination\PowerVR\GraphicsSDK\PVRTrace\Recorder\ Linux_armv7, too lazy to power the laptop up to check where are they located no Linux, but I am sure you'll figure it out if needed.

/opt/Imagination/PowerVR/GraphicsSDK/PVRTrace/Recorder/Linux_armv7

But using pvrtrace affects running application. E.g. colours are different. I'm not sure how this affects for logs.

freemangordon 2013-08-08 07:44

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by AapoRantalainen (Post 1365702)
But using pvrtrace affects running application. E.g. colours are different. I'm not sure how this affects for logs.

Hmm, that shouldn't happen, I guess you LD_PRELOAD wrong/not enough trace libs or some lib definition is missing in pvrtrace.cfg.

pablocrossa 2013-08-20 20:28

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Got Star Wars Jedi Knight: Jedi Academy to start a new game with correct graphics et al, this thing is awesome!! :)

Best lines in the log file:

Code:

GL_VENDOR: Imagination Technologies
GL_RENDERER: PowerVR SGX 530
GL_VERSION: 1.4 glshim wrapper

Great job and kudos to the original author and porters to Maemo5 :)

Estel 2013-08-20 20:41

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
:eek: I guess performance wasn't great, but thats not the point - I'm as much impressed. Any special tweaks were required? I would like to try it myself.

BTW, where the hell have you got ARM build?

/Estel

pablocrossa 2013-08-20 21:47

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by Estel (Post 1368441)
:eek: I guess performance wasn't great, but thats not the point - I'm as much impressed. Any special tweaks were required? I would like to try it myself.

BTW, where the hell have you got ARM build?

/Estel

I was impressed with the fact that it rendered completely accurately (appart from the typical star wars scrolling 3d text pre-mission ;) it just slid upwards but didn't disappear from its previous position creating a 'smudged' effect :( ).

Well I have some problems, mainly I can only set the quality level to Very High (even if I explicitly tell it to load the low file, got about 0.5fps), have to run it windowed and have no keyboard input... so yeah, requires fixing :P

I cloned this guy's git: https://github.com/xLAva/JediAcademyLinux
He has a linux port from JA, though it is only x86 and not great quality code with some hacks in place; he has however improved widescreen support, which I thought was important.

I had to port a couple of lines of ASM to c++ and play with some ifdef preprocessor macros to get it to choose 'unoptimized' c++ functions in favour of ASM. I also had to remove a couple of special fx (though honestly I haven't perceived the difference) plus a few cmake fixes and fix-along-as-compilation-errors-out procedure, might provide a patch once I iron out more errors and optimize the experience :) . oh and remove some x11 desktop code in favor of xrandr... but it works fine (sort of) :D

lunixbochs 2013-09-02 07:10

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
There's a full (and fast) GL ES / ARM NEON port for Jedi Knight Academy with source code on the Pandora forums.

http://boards.openpandora.org/index....3-jedi-academy

Estel 2013-09-03 02:24

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Now install Movie Batlles (modification to jedi academy multiplayer) on top of it, and if it works on playable state, you're guaranteed to end up in every multiplayer gaming/tech gadgets blog in the net.

After all, why not? It is Q3 engine, afterwards, and Q3 itself worked well on N900.

/Estel

taixzo 2013-09-03 03:10

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by Android_808 (Post 1365384)
blender? really? can you really imagine trying to use those menus? bragging only good if you can actually use it.

i was thinking more like porting of gl renderers for emulators, acceleration in app rendering, webgl, classic games (foobilliard, as suggested, if it runs ok would be cool), engines like irrlicht to help with new games.....

I spent half a year working in blender with my main device being a cheap laptop with a 200 mHz processor, 340 MB RAM, and a rather terrible graphics card; sure, it was terrible at rendering things, but decent enough for general blender as long as you did everything with keyboard shortcuts. Seeing as the N900 has a keyboard, I imagine it would work reasonably well.

pablocrossa 2013-09-03 18:11

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by lunixbochs (Post 1371237)
There's a full (and fast) GL ES / ARM NEON port for Jedi Knight Academy with source code on the Pandora forums.

Thank you!! To be honest my intention was never to create a port to distribute and perfect but rather to test this library and, in turn, further my knowledge :)

That being said the port looks great, will look into it, thanks :)

szopin 2013-09-03 21:14

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by lunixbochs (Post 1371237)
There's a full (and fast) GL ES / ARM NEON port for Jedi Knight Academy with source code on the Pandora forums.

That is sadly an exception to the rule, at least I couldn't find pandora src repo and most GNU licensed ports somehow skip the: share, part. Would you guys jump on GTA04 board upgrade by any chance?(sorry for OT but if moko and maemo finally joined up ranks, openpandora has some great coders, kudos to you lunixbochs)

www.rzr.online.fr 2013-09-05 06:12

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
FYI, it does build on harmattan too

https://github.com/harmattan/glshim

Will have to test it on device , I can release debs anyway just ask

https://openrepos.net/content/rzr/libglshim

AapoRantalainen 2013-09-05 08:33

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
Quote:

Originally Posted by lunixbochs (Post 1371237)
There's a full (and fast) GL ES / ARM NEON port for Jedi Knight Academy with source code on the Pandora forums.

Thanks for pointing (even it is offtopic)

There is Jedi Academy on pandora-forum (including links to the source code): http://boards.openpandora.org/index....-jedi-academy/
I have discussing there how to get it running properly on N900. I will announce it on on maemo-talk as soon there are something to play. And using it's NEON support needs gcc-4.8 (http://talk.maemo.org/showthread.php?t=90542). So it won't be in extras-devel (in a long time).

AapoRantalainen 2014-01-23 20:35

Re: Finally: GL to GLES runtime (glshim from openpandora)
 
I pushed new version (0.1-maemo4) of libglshim to the extras-devel.
It should show: libGL: built on Jan 23 2014 19:12:17
[EDIT] I have tested valyriatear, armagetronad and bloboats.

There were couple of commits on upstream from last autumn, not in Maemo's version. Main reason is there were one dependency missing on package.


All times are GMT. The time now is 20:20.

vBulletin® Version 3.8.8