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
- 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?
There's a YouTube playlist.
Where can I find the source?
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.
- 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:
Do you have any example apps?