Bug 4177 - (int-104253) SDL needs to be compiled with --enable-video-opengl option
(int-104253)
: SDL needs to be compiled with --enable-video-opengl option
Status: REOPENED
Product: Development platform
Tools
: 5.0-final
: All Linux
: Low normal with 1 vote (vote)
: ---
Assigned To: integration
: sdk-tools-bugs
: http://www.gossamer-threads.com/lists...
:
:
:
  Show dependency tree
 
Reported: 2009-03-03 12:38 UTC by Jayesh Salvi
Modified: 2010-03-09 12:37 UTC (History)
9 users (show)

See Also:


Attachments
NEEDS TESTING: libsdl with --enable-video-opengl (165.92 KB, application/x-debian-package)
2009-10-21 08:18 UTC, Quim Gil
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description Jayesh Salvi (reporter) 2009-03-03 12:38:25 UTC
SOFTWARE VERSION:
(Control Panel > General > About product)

STEPS TO REPRODUCE THE PROBLEM:

I had discussed this on the mailing list before:
http://www.gossamer-threads.com/lists/maemo/developers/44229

Try to run an application that uses SDL/pygame with opengl backend inside Maemo
Fremantle SDK and one gets an error:
X11 driver not configured with OpenGL

For e.g. http://people.freedesktop.org/%7Emacslow/gl-cairo-simple.tar.bz2



REPRODUCIBILITY:
always

SOLUTION:
I built SDL 1.2 from with the --enable-video-opengl option and ran the
gl-cairo-simple app above and some pygame apps with it. They worked fine.

Chk this link
(http://www.phoronix.com/forums/showthread.php?s=31dca4fc1886adfbaad91f0e4a83f288&t=11060&page=2)
for discussion of similar problem.

I don't know the location of build scripts that builds libsdl package in the
SDK, otherwise I could have provided a simple patch. But I have tested that
compiling with --enable-video-opengl helps to solve above problem.
Comment 1 Eero Tamminen nokia 2009-03-09 13:26:15 UTC
Does SDL OpenGL support work with OpenGL ES v2?
Comment 2 Jayesh Salvi (reporter) 2009-03-10 17:34:21 UTC
> Does SDL OpenGL support work with OpenGL ES v2?

Good question. I hardly know the answer. First result of google query leads to
a thread, where they discuss about plans to do it in SDL v1.3

http://www.nabble.com/SDL-and-OpenGL-ES-integration-td19150431.html

This google code search result from libsdl tells me, SDL definitely has opengl
es support of some sort.
http://www.google.com/codesearch/p?hl=en#bdMhFV0FLH8/include/SDL_opengles.h

I don't have access to any opengl ES library right now. (I know PowerVR SDK,
but I don't have it accessible now). You can try compiling SDL with the OpenGL
ES libraries you have from h/w vendor.
Comment 3 Andre Klapper maemo.org 2009-07-01 15:45:21 UTC
Still valid and no updates yet. :-(
Comment 4 Andre Klapper maemo.org 2009-07-30 15:48:13 UTC
The short internal comment today was "We are not supporting OpenGL in games".
Comment 5 Andre Klapper maemo.org 2009-08-28 16:02:15 UTC
According to Nokia, Nokia will not officially support OpenGL in games, hence
this is a WONTFIX.
Comment 6 Quim Gil nokia 2009-10-21 08:18:02 UTC
Created an attachment (id=1479) [details]
NEEDS TESTING: libsdl with --enable-video-opengl

Claudio was kind enough to recompile libsdl with --enable-video-opengl

He says:
> OK, here is a package built that way. I didn't even test it, feel free to test
> the games and see if anything with OpenGL actually works.
Comment 7 Quim Gil nokia 2009-10-21 08:52:40 UTC
Email sent to maemo-developers looking for testers.

Also http://talk.maemo.org/showthread.php?p=353549

Also http://twitter.com/quimgil/status/5038037110
Comment 8 Jayesh Salvi (reporter) 2009-10-21 10:23:27 UTC
As for the negative testing is concerned, it can be done by checking that no
existing functionality is broken with this new deb.

As for the positive testing is concerned, we need to test whether the
additional features (OpenGL support in SDL) provided in this new .deb work as
expected. The main motivation behind this bug is to get Frets on Fire's 3D
graphics working on n900. In order to do so we will also need python OpenGL
bindings. They are not available in extras or extras-devel right now. When I
had got FoF working in emulator I believe I compiled them locally. I will try
to do that again for the n900. But eventually we will need them in repos. Do
you want me to open a separate bug for that?

Once I have PyOpenGL compiled, I will test the provided .deb.
Comment 9 Jayesh Salvi (reporter) 2009-10-21 11:22:52 UTC
Ok I installed PyOpenGL on n900 and hit a roadblock (detailed stack track at
the end)

PyOpenGL expects /usr/lib/libGL* libraries. They are not present on n900, it
ships with /usr/lib/libEGL* libraries (part of opengles-sgx-img-common
package).

It worked for me in scratchbox few months back, because it has /usr/lib/libGL*
libraries. 

I looked for PyOpenGL support for OpenGL ES - but didn't find anything
concrete. The only supported library found is from the PyS60 project
(http://pys60.garage.maemo.org/doc/s60/module-gles.html).

I doubt that EGL provides the same API as GL. So even if python bindings are
found for EGL, they won't work out-of-the-box with existing code that is
written for GL (code like FoF). But I might be wrong.

Detailed stack trace:
------------------------

Nokia-N900-39-9:/home/user#
PYTHONPATH=$PYTHONPATH:/home/user/usr/lib/python2.5/site-packages python2.5 
Python 2.5.4 (r254:67916, Jul 30 2009, 23:14:45) 
[GCC 4.2.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenGL
>>> import OpenGL.GLU
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/usr/lib/python2.5/site-packages/OpenGL/GLU/__init__.py",
line 2, in <module>
    from OpenGL import platform
  File
"/home/user/usr/lib/python2.5/site-packages/OpenGL/platform/__init__.py", line
36, in <module>
    _load()
  File
"/home/user/usr/lib/python2.5/site-packages/OpenGL/platform/__init__.py", line
27, in _load
    plugin_class = plugin.load()
  File "/home/user/usr/lib/python2.5/site-packages/OpenGL/plugins.py", line 14,
in load
    return importByName( self.import_path )
  File "/home/user/usr/lib/python2.5/site-packages/OpenGL/plugins.py", line 28,
in importByName
    module = __import__( ".".join(moduleName), {}, {}, moduleName)
  File "/home/user/usr/lib/python2.5/site-packages/OpenGL/platform/glx.py",
line 8, in <module>
    class GLXPlatform( baseplatform.BasePlatform ):
  File "/home/user/usr/lib/python2.5/site-packages/OpenGL/platform/glx.py",
line 16, in GLXPlatform
    mode=ctypes.RTLD_GLOBAL 
  File
"/home/user/usr/lib/python2.5/site-packages/OpenGL/platform/ctypesloader.py",
line 53, in loadLibrary
    return dllType( name, mode )
  File "/usr/lib/python2.5/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: ('GL: cannot open shared object file: No such file or directory',
'GL', None)
Comment 10 Niels Breet maemo.org 2009-10-21 12:07:39 UTC
You know that the device doesn't support OpenGL, right?
Comment 11 Jayesh Salvi (reporter) 2009-10-21 12:19:03 UTC
Yes I know. So far, this has been an exercise to find the exact reason why it
worked in scratchbox and won't work on n900. I believe we have the answer. 

As for FoF, I already have a minimal version that bypasses OpenGL and works
with plain pygame.
Comment 12 Niels Breet maemo.org 2009-10-21 12:28:05 UTC
I explained the issue here:

http://talk.maemo.org/showpost.php?p=353648&postcount=2
Comment 13 Mikko Vartiainen 2009-10-21 13:45:23 UTC
I got impression from Quim that this new version has GL ES support. It's
backported from SDL1.3, right?

Anyway I have noticed that with plain 2D games framerates have been dropped
even by 20-30%. I got this result by simply monitoring FPS reported by supertux
and wormux, so it's not very reliable. If somebody could confirm that would be
great.

To be able to test GL ES programs, shouldn't there also be updated -dev package
with headers?
Comment 14 Jayesh Salvi (reporter) 2009-10-21 14:00:49 UTC
Thanks Niels for the pointer. Now that we are on subject, are there any plans
for python bindings for OpenGL-ES? Or pyclutter and pyside (qt) will be the
only ways to use opengles from python?
Comment 15 Quim Gil nokia 2009-10-21 14:06:26 UTC
See this comment from javispedro:
http://talk.maemo.org/showpost.php?p=353659&postcount=3

And search for "SDL" at http://maemo.org/packages/
Comment 16 Kate Alhola nokia 2009-10-21 15:23:12 UTC
> It worked for me in scratchbox few months back, because it has /usr/lib/libGL*
> libraries. 
> 
> I looked for PyOpenGL support for OpenGL ES - but didn't find anything
> concrete. The only supported library found is from the PyS60 project
> (http://pys60.garage.maemo.org/doc/s60/module-gles.html).
> 
> I doubt that EGL provides the same API as GL. So even if python bindings are
> found for EGL, they won't work out-of-the-box with existing code that is
> written for GL (code like FoF). But I might be wrong.

That's little bit more complicated, there is no single OpenGL-API but there
is OpenGL 1.0, 1.1, 2.0 .. 3.0  etc. OpenGL used to be compatible with
older versions and introduced only new API's but now in OpenGL 3.x some
legacy  API's are dropped.

OpenGL-ES is not API compatible at all. OpenGL-ES 1.x has OpenGL 1-x style
fixed function pipeline but lot of redundant API's are removed. OpenGL-ES 2.x
is
completelyt other spiece of animal, it implements only programable function
pipeline and does not support OpenGL(ES) 1.x style fixed function API at all.

Scratchbox provides OpenGL emulatiion libraries and OpenGL-ES emulation 
libraries are extra Maemo5 provides both OpenGL-ES2.0 and OpenGL-ES1.x
libraries.

Conclusions:
- If you compile in scratchbox against OpenGL-libraries, it don't work in
device
  for that reason, i made OpenGL-ES emulation library package for scratchbox
- If you have application that uses OpenGL 1.x API, it is possible to port it
to use OpenGL-ES1.x API but it needs porting work
- If you would like to port OpenGL-1.x API to OpenGL-ES2.0 you need more work 
 to take programble function pipeline to use.

Even Andre Klapper said that Maemo does not support OpenGL games, it does.
Bounce is OpenGL-ES2.0 game that uses programable shaders as example
for water reflections.
Comment 17 Andre Klapper maemo.org 2009-10-21 15:32:24 UTC
(In reply to comment #16)
> Even Andre Klapper said that Maemo does not support OpenGL games, it does.

Just to clarify, in comment 4 here I quoted Erik from int-104253 comment 10
from July 2009.
Comment 18 Michel Dänzer 2010-03-09 12:37:49 UTC
FWIW, it might be possible to get at least some degree of OpenGL support by
writing a Gallium3D driver which emits GLES2 shaders at the backend. Though
there may be some limitations (e.g. GLES2 shader capabilities or supported
vertex formats) which make this impractical.