glshim


lunixbochs

Moderator
Staff member
Joined
Sep 18, 2011
Messages
742
What is this?
A performant library implementing major parts of OpenGL 1.x by internally translating to OpenGL ES and filling the gap where necessary.

 
Does this mean I will be able to compile any OpenGL program and have it work perfectly on the Pandora?
No. Some GL calls are extremely impractical or slow to emulate/wrap.
 
Which calls *does* it implement?
This lib exposes a rough glX ~1.3 interface for apps to initialize GL, all calls available in GL ES, and the following:

  • display lists
  • gl immediate mode (glBegin/End)
  • dashed/dotted lines (glLineStipple)
  • raster operations (glBitmap, glDrawPixels)
  • texture/pixel swizzling
  • glPush/PopAttrib
  • evaluators (glMap, glEvalCoord, glEvalMesh)
I also have a precompiled libGLU.so from https://github.com/lunixbochs/glues/ for your convenience.
 
Does that mean it's finished?
Not even close.
 
Why do I want this?
Many GL apps will compile out of the box + start and render accurately/quickly with zero modification. This means a porter can spend most of his/her time on better controls, UI, and optimization without as much worrying about how to implement line stipples or display lists.
If an app *does* need rendering changes, the created context is completely compatible with ES code. You can optimize slow parts of the app's rendering pipeline and leave SDL / GL init code alone.
 
What about all the resulting crappy "compile and forget" ports?
If this library enables *one* good newly-released title, it was worth it.
If you don't like an app on the repo, downvote it to oblivion.
 
Do you have any gameplay videos?

https://www.youtube.com/embed/videoseries?list=PL2wTcyeSmhsYUV2BZ_WLpQISMQEiPYmoC
 
Where can I find the source?
https://github.com/lunixbochs/glshim
 
Any known issues?
Yes! It's still missing parts of the GL spec.
  • It only supports GL 1.x, without shaders.
  • raster operations are pretty fast, but don't respect Z-order
  • glTexGen only implements SPHERE_MAP and OBJECT_LINEAR
  • glPush/PopAttrib is incomplete
Some issues are fixed by LD_PRELOAD'ing the included libpreload.so or setting LIBGL_FB=1:

  • Multiple XOpenDisplay() connections can break the SGX driver.
  • SDL_SetGamma crashes.
If your app freezes anyway, preload might not work for X11. In this case, set the direct framebuffer environment variable.

Compatibility issues:

  • GLUT: I had to use GLUT_DOUBLE in glutInitDisplayMode() (double buffering), and set glutIdleFunc(render function);
Where can I get it?
http://bochs.info/pnd/.gl/ - This is probably not for the faint of Linux.
Test thoroughly before you release anything with it. Obscure GL states can cause undefined behavior.
 
How do I use it?

  • Download libGL.so.1 and libGLU.so.1.
  • Put them in a library directory like "$HOME/lib". I don't recommend putting them in /usr/lib.
  • In your .bashrc, do `export LD_LIBRARY_PATH="$HOME/lib"` to enable them.
Environment variable options:

  • LIBGL_DEBUG=1 - enable additional debug output.
  • LIBGL_FB=1 - force rendering to the framebuffer instead of an X11 window. Make sure the application sets a resolution of 800x480 first.
  • LIBGL_FPS=1 - print fps to command line.
  • LIBGL_SHRINK=1 - do a very bad job of shrinking textures on load. I don't recommend it  ;)
  • LIBGL_STACKTRACE=1 - generate a stacktrace on crash. This only works if you compile your app with -funwind-tables.
  • LIBGL_TEXDUMP=1 - dump all loaded textures to /tmp/*.ppm. You should really use PVRTrace instead.
  • LIBGL_VSYNC=1 - wait for vsync on fb0 each frame. You should probably just use powervr.ini and LIBGL_FB=1 for this.
  • LIBGL_XREFRESH=1 - call `xrefresh` on exit. Be careful, as this is preliminary and might break signal handlers in the app.
I enabled vsync. Why do I still see tearing with framebuffer output!?
You need to put a file in your current directory named powervr.ini with the following contents:


[default]
WindowSystem=libpvrPVR2D_FLIPWSEGL.so
Do you have any example apps?

 
Last edited by a moderator:
Wooooow so Cool ^_^

I waited for Years for a working OpenGL Wrapper for the Pandora

(naturaly not fully working but very very cool) That help us many more than that slowly OpenGL Mesa Emulation :)

Many THX for Releasing this ;)

Now i must make a New Dev SD Card with newest Firmware here to try :D
 
Last edited by a moderator:
Wohoooo ! That's great ! I'm grabing this and trying some experiments with that !

(I'll start with simples things, like Jumpman and catatiles, and then I'll try to mess with blender / blenderplayer).
 
Last edited by a moderator:
Yeah much much more easy possible Games ^_^

Maybe i release a Pandora DEV Image with it for all when finished ^_^

Edit: Oh ok i readed the thread again and the Developer dont want to Release anything with it,its for testing Things.

Ok then i try only for me and when i success anything i can write it here :)
 
Last edited by a moderator:
So, first try, with an already compiled Jumpman.

First the good news:

 * The games works, and it has got the right Speed :) !

 * All is presents, fonts (used ftgl) and gfx.

The Bad news:

 * Gfx were upside-downs. I have to check more precisely what kind of trnsformation (is it miror or rotation 180° ?), or just do a screen shot, it will be easier. I also have to check what the game is using draw is pixels (but I think "sprites" are a bunch of pixel, and each pixel is a quad, so a sprite is a bunch of quads stored in a glList...

 * I couldn't exits the game properly. I select Quit, but the screen stayed the same, the mouse was mouving, but no exit of full screen.

Still, very very very promising ! I'll try other stuff (allegro 5.0.8 is next, with Meka 0.80 as target).
 
wow, something I was hopeing to see even more than psp or DS emulation... we really gets some nice treats for christmas this year...
 
Yeah that thought i too :)

Cool News since one Month :lol:

But we shall not forget this is in Beta Phase too,but seem to work very Fine ;)

Many THX again for releasing that ^_^
 
How will you decide whether or not to make this an open source project?

Anyway, this is a very interesting and promising project, and not just for the Pandora.

Too bad the (proprietary) GPU driver we are stuck with seems to be kind of crappy. I wonder if it would be an interesting approach to try to make an OpenGL implementation that doesn't use GL|ES, but hand-optimized NEON code?

Are you planning to submit this to the coding compo? I'm not sure what category this would be, but it certainly deserves a prize!
 
How will you decide whether or not to make this an open source project?

Anyway, this is a very interesting and promising project, and not just for the Pandora.

Too bad the (proprietary) GPU driver we are stuck with seems to be kind of crappy. I wonder if it would be an interesting approach to try to make an OpenGL implementation that doesn't use GL|ES, but hand-optimized NEON code?

Are you planning to submit this to the coding compo? I'm not sure what category this would be, but it certainly deserves a prize!
In extension to this - would it possible to have a wrapper that uses stable GPU functionality where possible and optimised NEON where not possible?
 
OMG this is great  :)

Can't wait to try it with my unfinished port of GL117
 
Last edited by a moderator:
I tried with catatiles (i.e. cataclym roguelike TileMap mod), but it need glDrawBuffer. I have to see what is this function...
 
Released at last :)


Now if somebody finds some unimplemented stuff, they can report it here or give you hints or code on how to implement it.
 
now I'dd need an arx libertatis port...
I got it to compile, but it runs horribly.
I tried with catatiles (i.e. cataclym roguelike TileMap mod), but it need glDrawBuffer. I have to see what is this function...
I'l take a look at glDrawBuffer.

Tip for anyone trying a port that doesn't work - if you make the binaries available for me, I can try to fix whatever's broken in the lib that prevents it from rendering properly.


I already have GL builds of aquaria, armagetron, arx libertatis, cube, foobillard, jumpman, neverball, octaspire crates, trigger rally, and uplink I've been using to test.
 
Last edited by a moderator:
Back
Top