OpenGL ES Libraries

(Xlib (X11))
Line 44: Line 44:
== Notes ==
== Notes ==
-
When you create a X11 window the hildon compositor should be disabled. This can be done by setting the property _HILDON_NON_COMPOSITED_WINDOW. There is an example Xlib application with this property set available at http://exoticorn.de/simpleglv2.tgz (http://talk.maemo.org/showthread.php?t=37356&page=2).
+
* When you create a X11 window the hildon compositor should be disabled. This can be done by setting the property _HILDON_NON_COMPOSITED_WINDOW. There is an example Xlib application with this property set available at http://exoticorn.de/simpleglv2.tgz (http://talk.maemo.org/showthread.php?t=37356&page=2).
-
It appears that OpenGL ES 1.x code gets translated into OpenGL ES 2.x code using an emulation library on the Nokia N900. Is this true? If so is there a performance impact?
+
* OpenGL and OpenGL ES are very different and are not compatible.  
 +
 +
* WARNING: If you try to run an OpenGL application with scratchbox then it will most likely work. This is because it uses the native operating system OpenGL libraries to execute. However, if you try and run it on the device it will not work as it only has OpenGL ES libraries.  
-
OpenGL and OpenGL ES are very different and are not compatible.  
+
* WARNING: OpenGL ES doesn't run natively on a desktop computer. It is possible to get some kind of emulation library from the Khronos OpenGL ES 2.0 SDK so that you can test on a desktop computer.
-
WARNING: If you try to run an OpenGL application with scratchbox then it will most likely work. This is because it uses the native operating system OpenGL libraries to execute. However, if you try and run it on the device it will not work as it only has OpenGL ES libraries.
+
* OpenGL ES 1.x and OpenGL ES 2.x are also different. OpenGL ES 1.x has a fixed pipeline whereas OpenGL ES 2.x uses shaders. The matrix stack has also been removed and you have to manage it yourself.
-
 
+
-
WARNING: OpenGL ES doesn't run natively on a desktop computer. It is possible to get some kind of emulation library from the Khronos OpenGL ES 2.0 SDK so that you can test on a desktop computer.
+
-
 
+
-
OpenGL ES 1.x and OpenGL ES 2.x are also different. OpenGL ES 1.x has a fixed pipeline whereas OpenGL ES 2.x uses shaders. The matrix stack has also been removed and you have to manage it yourself.
+
=== Killing hildon ===
=== Killing hildon ===

Revision as of 04:57, 22 December 2009

Want to start developing for the Nokia N900 using OpenGL ES but don't know where to start?

Here is some information about the various libraries and APIs that are available on the N900. Also included is information about developing with OpenGL ES and some examples.

Contents

Library Support

This section includes a partial list of library options for using OpenGL ES.

SDL

Apparently SDL 1.3 supports OpenGL ES 1.x (unsure about OpenGL ES 2.0 support).

OpenGL ES 1.x utilies

Information:

http://www.unrealvoodoo.org/hiteck/projects/maemo/

Git repositories:

http://www.unrealvoodoo.org/git/

Sami Kyöstilä has developed a number of utilities. This includes SDL with OpenGL ES 1.x support, libglutes, python-opengles and several translators to convert OpenGL ES and OpenGL.

Qt

You can use Qt with OpenGL ES 2.x on the Nokia N900. There is an example application called hellogl_es2. Get it here:

http://qt.gitorious.org/qt/qt/trees/4.5/examples/opengl/hellogl_es2

This example shows how to use OpenGL ES embedded in a QtWidget.

Clutter

libclutter supports OpenGL ES 2.x. It seems oriented towards toolkits and applications with user interface elements.

Xlib (X11)

You can use Xlib (X11) and utilise the EGL library for context creation along with OpenGL ES. This is what the Bounce Evolution game uses.

You can use OpenGL ES version 1 or 2 directly without worrying about the version that is supported by the library.

See below for an example Xlib application.

PVRShell

The Khronos OpenGL ES 2.0 SDK includes a simple API for window creation called PVRShell. They also include additional tools for more advanced computer graphics applications. It is much simpler to create an OpenGL ES 2.0 application using PVRShell. It doesn't seem to have much support for handling events.

Notes

  • OpenGL and OpenGL ES are very different and are not compatible.
  • WARNING: If you try to run an OpenGL application with scratchbox then it will most likely work. This is because it uses the native operating system OpenGL libraries to execute. However, if you try and run it on the device it will not work as it only has OpenGL ES libraries.
  • WARNING: OpenGL ES doesn't run natively on a desktop computer. It is possible to get some kind of emulation library from the Khronos OpenGL ES 2.0 SDK so that you can test on a desktop computer.
  • OpenGL ES 1.x and OpenGL ES 2.x are also different. OpenGL ES 1.x has a fixed pipeline whereas OpenGL ES 2.x uses shaders. The matrix stack has also been removed and you have to manage it yourself.

Killing hildon

This doesn't need to be done anymore if the _HILDON_NON_COMPOSITED_WINDOW attribute is set. This is included for reference.

You can kill the hildon window manager with:

  dsmetool -k /usr/bin/hildon-desktop

Restore with:

  dsmetool -t /usr/bin/hildon-desktop

Installation and Examples

Here are some notes about packages required for OpenGL ES development and some simple examples to help get you started. You can compile OpenGL ES applications with scratchbox. The ESBox IDE makes it much easier to execute the application on the device. It automates copying the binary onto the device and execution.

Firstly you want to install the following packages on scratchbox.

[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install libgles2-sgx-img-dev

This is the OpenGL ES 2.x development files required for compiling. Note: you need to add the nokia-binaries repository to install this in scratchbox.

[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install opengles-sgx-img-common-dev

This installs the EGL library (used for portable context creation, see the docs) and PowerVR development files. It also includes some simple demos. This also requires nokia-binaries.

Nokia-N900-42-11:~# apt-get install libgles1-sgx-img opengles-sgx-img-common

Installs the required libraries to use OpenGL ES on the N900.


Qt Example

You need to install libqt4-opengl-dev.

It doesn't install any examples, so download the hellogl_es2 example from here: http://qt.gitorious.org/qt/qt/trees/4.5/examples/opengl/hellogl_es2

You need to modify glwidget.h and change #include <QGLWidget> to #include <QtOpenGL/QGLWidget>. Also, in the hellogl_es2.pro file you should add:

LIBS += -lGLESv2 -lQtOpenGL

Then run:

qmake -project

qmake

make

Which will (hopefully) compile hellogl_es2. Then you can copy the binary to the device and run it.

X11 Examples

You can usually compile any X11 examples with a simple Makefile like:

CC=g++
LDLIBS=-lEGL -lX11 -lGLESv2 
all: main
main: main.o

In the PowerVR SDK TrainingCourse directory there are a number of examples. The first two use only Xlib. The rest make use of PowerVR libraries which have to be linked in with the program.

There is a nice simple example at the Maemo Talk page (http://talk.maemo.org/showthread.php?t=37356). You can download it from http://exoticorn.de/simpleglv2.tgz


Resources

Here are some resources.