mgandrewjackson
Posts: 1
Joined: Mon Jan 14, 2013 6:56 pm

GLESPort

Fri Jan 18, 2013 6:31 pm

Greetings,

I've been working on http://unrealvoodoo.org/git/glesport.git/ GLESPort, that translates OpenGL Calls to OpenGL ES by way of Mesa.

I don't have a Pi yet, I'm working on an Arm Chromebook running Ubuntu with the Mali OpenGL ES Driver Binaries Copied over from the Chrome OS.

Anyway, I thought some Pi owners my want to look at this code as a way of getting older OpenGL games running. When the code was fresh it supported Quake2 so games of that era should be made to work, I know there's an OpenGL ES port of YQuake2 for the Pi, but I've had some luck getting Quake 1 DarkPlaces to run under GLESPort, yet not very well.

The source code looks good, only it includes an outdated Mesa, tho I'm not sure that's an issue. It should be simple to add GLESv2 Calls if any programmer wants to pick up the project. It seems like it would be simpler than porting older titles one by one.

It's a bit confusing to compile, clone it from the git repo, then you'll want to edit:

/mesa-7.0.1~rc2/src/mesa/drivers/gles/glesdrv.h

Around Line #64:

Code: Select all

/* FIXME: Make this configurable */
#define EGL_LIBRARY_NAME  "libEGL.so"
#define GLES_LIBRARY_NAME "libGLESv1_CM.so"
Just add your GLES and ELG LIBRARY Names, you may need to make other specific Pi related changes?

You can also add:

Code: Select all

#define GLESv2 LIBRARY_NAME "libGLESv2.so" 
If you're going to start adding GLESv2 Function Calls this is the place to start, but that's only if you're going to define some GLESv2 Functions. Otherwise just ignore it.

Now you'll want to edit the /mesa-7.0.1~rc2/src/mesa/Makefile:

Around Line #95:

Code: Select all

$(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS) -LGLES_CM
Change to:

Code: Select all

$(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS) -lGLESv1_CM -lEGL
Or if you added GLESv2

Code: Select all

$(COMMON_DRIVER_OBJECTS) $(GL_LIB_DEPS) -lGLESv1_CM -lEGL -lGLESv2
And whatever other Pi specific Libs you may have added.

Now you're ready to try and compile, here comes the tricky part.

cd to the /mesa-7.0.1~rc2/ dir and run:

Code: Select all

make realclean
Just to be safe, then run:

Code: Select all

make linux
You'll get some errors, it's ok, just ignore them, it's normal.

Next cd to the /mesa-7.0.1~rc2/src/mesa/

Code: Select all

cd /mesa-7.0.1~rc2/src/mesa/
Next run:

Code: Select all

make gles
This will make the libGL.so that does the translating and installl it in the /mesa-7.0.1~rc2/lib/ dir.

This will take a while, so go get a cup of coffee, once it's done cd back to the /mesa-7.0.1~rc2/ dir

Code: Select all

cd ../

Code: Select all

cd ../
Now run make from that dir.

Code: Select all

make
After a while make will quit with some errors about "depend", don't worry this is still normal. Next the last make replaced a file in the lib dir we need to get it back before we run make again.

Code: Select all

ln -fs /mesa-7.0.1~rc2/lib/libGL.so.7.0.1 /mesa-7.0.1~rc2/lib/libGL.so.1
This is the tricky part, there is a bug that it tries to replace the libGL.so.1 symbolic link to link it to a broken libGL.so.

Now that we're done with that, run make again:

Code: Select all

make
It will quit on you a few more times with errors just keep running make until it won't compile anymore.

Some targets are not going to get built, but that's ok, they're just some of the demos. Once make has finished you should have /mesa-7.0.1~rc2/lib/

Code: Select all

libGL.so             libGLU.so             libglut.so.3.7.1  libOSMesa.so.6
libGL.so.1           libGLU.so.1           libGLw.so         libOSMesa.so.6.5.3
libGL.so.1.5.070001  libGLU.so.1.3.070001  libGLw.so.1
libGL.so.7           libglut.so            libGLw.so.1.0.0
libGL.so.7.0.1       libglut.so.3          libOSMesa.so
Now to use them open a terminal and type:

Code: Select all

LD_LIBRARY_PATH=full/path/to/mesa-7.0.1~rc2/lib/
Replace full/path/to with the full path to the mesa-7.0.1 dir:

Code: Select all

export LD_LIBRARY_PATH
That's it, now any OpenGL apps you launch from that terminal will use the libGL from that PATH.

If you have glxgears installed you can try that, it works for me, but only in black and white wire-frame.

Otherwise you may want to checkout the demos in /mesa-7.0.1~rc2/progs/demos/

Some of them work, some, most, don't. Bounce and Geartrain work the best, as proof of concept. They run about 20x as fast in GLES/GL as the do in SoftWare Rendering. So there is really no speed hit in the translation calls.

Well, that's it, I hope some Pi owner tries this out and let's us know how it runs.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: GLESPort

Fri Jan 18, 2013 8:33 pm

Bookmarked. Thanks for your post.


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “OpenGLES”