1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice

glshim

Discussion in 'General Discussions' started by lunixbochs, Jan 11, 2013.

  1. lunixbochs

    lunixbochs Moderator Staff Member

    Joined:
    Sep 18, 2011
    Messages:
    737
    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: Jul 16, 2013
  2. crow_riot

    crow_riot Well-Known Member

    Joined:
    Sep 21, 2009
    Messages:
    1,763
    Location:
    .at
    wow this is awesome!
     
  3. ingoreis

    ingoreis Advanced Member

    Joined:
    Mar 7, 2012
    Messages:
    2,512
    Location:
    49.491276,8.423518
    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: Jan 11, 2013
  4. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    6,249
    Location:
    France, near Lyon
    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: Jan 11, 2013
  5. ingoreis

    ingoreis Advanced Member

    Joined:
    Mar 7, 2012
    Messages:
    2,512
    Location:
    49.491276,8.423518
    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: Jan 11, 2013
  6. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    6,249
    Location:
    France, near Lyon
    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).
     
  7. ingoreis

    ingoreis Advanced Member

    Joined:
    Mar 7, 2012
    Messages:
    2,512
    Location:
    49.491276,8.423518
    Plz can you try Tux Racer?

    That Game would be fun like BillardGL ^_^
     
  8. elwing

    elwing Rabbit Addict

    Joined:
    Feb 23, 2009
    Messages:
    2,822
    wow, something I was hopeing to see even more than psp or DS emulation... we really gets some nice treats for christmas this year...
     
  9. ingoreis

    ingoreis Advanced Member

    Joined:
    Mar 7, 2012
    Messages:
    2,512
    Location:
    49.491276,8.423518
    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 ^_^
     
  10. elwing

    elwing Rabbit Addict

    Joined:
    Feb 23, 2009
    Messages:
    2,822
    now I'dd need an arx libertatis port...
     
  11. PokeParadox

    PokeParadox Founder of Pirate Games - Penjin Coder Staff Member

    Joined:
    Dec 8, 2005
    Messages:
    6,399
    Location:
    UK
    OMG This is just the sex!

    Congratulations I guess eventually the lib can come as default in the firmware?
     
  12. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    6,249
    Location:
    France, near Lyon
    Hey, Tux and BillardGL was in my "I'll try to ports those when I have ported the ones I'm working on"... I try not to have too many ports going on at the same time.
     
  13. _wb_

    _wb_ Microbe Staff Member

    Joined:
    Apr 5, 2012
    Messages:
    5,370
    Location:
    Brussels, Belgium
    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!
     
  14. PokeParadox

    PokeParadox Founder of Pirate Games - Penjin Coder Staff Member

    Joined:
    Dec 8, 2005
    Messages:
    6,399
    Location:
    UK
    In extension to this - would it possible to have a wrapper that uses stable GPU functionality where possible and optimised NEON where not possible?
     
  15. Farox

    Farox Certified Guru

    Joined:
    Jan 8, 2009
    Messages:
    1,742
    Location:
    Italy
    OMG this is great  :)

    Can't wait to try it with my unfinished port of GL117
     
    Last edited by a moderator: Jan 11, 2013
  16. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    6,249
    Location:
    France, near Lyon
    I tried with catatiles (i.e. cataclym roguelike TileMap mod), but it need glDrawBuffer. I have to see what is this function...
     
  17. skeezix

    skeezix Certified Guru

    Joined:
    Mar 11, 2003
    Messages:
    7,969
    Really great project, thank you for undertaking it :)

    jeff
     
  18. mcobit

    mcobit Advanced Member

    Joined:
    Jul 28, 2008
    Messages:
    6,755
    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.
     
  19. lunixbochs

    lunixbochs Moderator Staff Member

    Joined:
    Sep 18, 2011
    Messages:
    737
    I got it to compile, but it runs horribly.
    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: Jan 11, 2013
  20. Linux-SWAT

    Linux-SWAT Advanced Member

    Joined:
    Feb 13, 2010
    Messages:
    7,189

Share This Page