OpenGL-ES

Line 1: Line 1:
[[Category:Development]]
[[Category:Development]]
-
== OpenGL-ES  ==
+
== OpenGL ES  ==
-
Maemo OpenGL-ES  
+
Maemo OpenGL ES  
 +
=== Books about OpenGL ES ===
-
=== Books about OpenGL-ES ===
+
* [http://www.amazon.com/Mobile-3D-Graphics-Kaufmann-Computer/dp/0123737273/ref=sr_1_1?ie=UTF8&s=books&qid=1235944663&sr=8-1 Mobile 3D graphics with OpenGL ES and M3G"]
-
 
+
* [http://www.amazon.com/OpenGL ES-2-0-Programming-Guide/dp/0321502795/ref=sr_1_1?ie=UTF8&s=books&qid=1235944783&sr=1-1 OpenGL ES 2.0 programming guide]
-
* [http://www.amazon.com/Mobile-3D-Graphics-Kaufmann-Computer/dp/0123737273/ref=sr_1_1?ie=UTF8&s=books&qid=1235944663&sr=8-1 Mobile 3D graphics with OpenGL-ES and M3G"]
+
-
* [http://www.amazon.com/OpenGL-ES-2-0-Programming-Guide/dp/0321502795/ref=sr_1_1?ie=UTF8&s=books&qid=1235944783&sr=1-1 OpenGL ES 2.0 programming guide]
+
=== Other documentation ===
=== Other documentation ===
-
* [http://www.khronos.org/opengles/2_X/ Khronos OpenGL-ES documentation and specifications]
+
* [http://www.khronos.org/opengles/2_X/ Khronos OpenGL ES documentation and specifications]
=== Imagination Technologies SDK ===
=== Imagination Technologies SDK ===
-
* [http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES2xSGX.asp OpenGL-ES SDK]
+
* [http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES2xSGX.asp OpenGL ES SDK]
=== Other related documentation ===
=== Other related documentation ===
-
* [http://blogs.forum.nokia.com//data/blogs/resources/300003/fremantle_bossa_2009.pdf Kate's presentaion in Bossa 2009 conference] about Fremantle and section about OpenGL-ES2.0
+
* [http://blogs.forum.nokia.com//data/blogs/resources/300003/fremantle_bossa_2009.pdf Kate's presentaion in Bossa 2009 conference] about Fremantle and section about OpenGL ES2.0
-
 
+
=== OpenGL variants ===
=== OpenGL variants ===
[[image:Opengl.svg]]
[[image:Opengl.svg]]
-
* OpenGL-1.0 has fixed shaders and fixed API to using them
+
* OpenGL 1.0 has fixed shaders and fixed API to using them
-
* OpenGL-2.0 adds programable shaders but fixed pipeline api is still there for backward compatibility
+
* OpenGL 2.0 adds programable shaders but fixed pipeline api is still there for backward compatibility
-
* OpenGL-ES1.0 is OpenGL-1.0 with lot of "syntactic sugar". extra redundant API's removed and fractional integer API added
+
* OpenGL ES 1.0 is based on OpenGL 1.0 with extra redundant API's removed and fixed point (fractional integer) API added
-
* OpenGL-ES2.0 is OpenGL-2.0 using programable shaders is mandatory, all old fixed pipeline API's removed
+
* OpenGL ES 2.0 is based on OpenGL 2.0, so using programmable shaders is mandatory, since all old fixed function API's have been removed
-
=== Porting between openGL variants ===
+
=== Porting between OpenGL variants ===
-
* OpenGL-1.0 application works with OpenGL-2.0 but not opposite
+
* OpenGL 1.0 application works with OpenGL 2.0 but not vice versa
-
* OpenGL-1.0 application is possible to port to OpenGL-ES1.0 but needs work if it is using some of removed API's
+
* OpenGL 1.0 application is possible to port to OpenGL ES 1.0, but needs work if it is using some of the removed API's
-
* OpenGL-2.0 application that uses programable shaders is possible to port OpenGL-ES2.0 but may need so me work
+
* OpenGL 2.0 application that only uses programmable shaders is possible to port OpenGL ES 2.0, but may still need some work
-
* Porting OpenGL1.0 or OpenGL-ES1.0 applications to OpenGL-ES2.0 needs lot of rewrite to use programable shaders.
+
* Porting OpenGL 1.0 or OpenGL ES 1.0 applications to OpenGL ES 2.0 needs a rewrite to replace fixed function API usage with programmable shaders
=== Compiling under scratchbox ===
=== Compiling under scratchbox ===
-
To compile OpenGL-ES2.0 applivations you need to have package "libgles2-dev" installed.
+
To compile OpenGL ES 2.0 applivations you need to have package "libgles2-dev" installed.
It is as standard, part of Fremantle aplha ARMEL but at the moment it is missing from x86 version.
It is as standard, part of Fremantle aplha ARMEL but at the moment it is missing from x86 version.
-
We try to get x86 equivalent opengl-es2 emulation library available soon.
+
We try to get x86 equivalent OpenGL ES2 emulation library available soon.
-
There is excellent way to familiarize yourself to OpenGL-ES2.0 by trying the  
+
There is excellent way to familiarize yourself to OpenGL ES 2.0 by trying the  
-
PoverVR tutorials that can be found form SDK under TrainingCouse ridectory.
+
PoverVR tutorials that can be found form SDK under TrainingCouse directory.
The examples have their own Makefiles for Linux host but you can copy the files
The examples have their own Makefiles for Linux host but you can copy the files
to your own directory and try makefile below. Reason to use this own Makefile is
to your own directory and try makefile below. Reason to use this own Makefile is
Line 79: Line 77:
for desktop opengl and opengl_es2 .
for desktop opengl and opengl_es2 .
-
The example is also good showing what is diference between OpenGL versions.
+
The example is also good showing what is different between OpenGL versions.
-
The hellogl uses plain desktop "glBegin / glEnd" method with display lists
+
The hellogl uses plain desktop "glBegin / glEnd" functions with display lists. Hellogl_es2 uses vertex attribute pointers and shaders instead of glBegin/glEnd.
-
as speed up method. Hellogl_es2 uses vertex attribute pointers instead glBigin/glEnd .
+
The helloes_gl2 is even more complicated because it uses programmable shaders  
The helloes_gl2 is even more complicated because it uses programmable shaders  
instead fixed pipeline in both of the previous exaples.  
instead fixed pipeline in both of the previous exaples.  

Revision as of 13:11, 26 March 2009

Contents

OpenGL ES

Maemo OpenGL ES

Books about OpenGL ES

Other documentation

Imagination Technologies SDK

Other related documentation

OpenGL variants

image:Opengl.svg

  • OpenGL 1.0 has fixed shaders and fixed API to using them
  • OpenGL 2.0 adds programable shaders but fixed pipeline api is still there for backward compatibility
  • OpenGL ES 1.0 is based on OpenGL 1.0 with extra redundant API's removed and fixed point (fractional integer) API added
  • OpenGL ES 2.0 is based on OpenGL 2.0, so using programmable shaders is mandatory, since all old fixed function API's have been removed

Porting between OpenGL variants

  • OpenGL 1.0 application works with OpenGL 2.0 but not vice versa
  • OpenGL 1.0 application is possible to port to OpenGL ES 1.0, but needs work if it is using some of the removed API's
  • OpenGL 2.0 application that only uses programmable shaders is possible to port OpenGL ES 2.0, but may still need some work
  • Porting OpenGL 1.0 or OpenGL ES 1.0 applications to OpenGL ES 2.0 needs a rewrite to replace fixed function API usage with programmable shaders

Compiling under scratchbox

To compile OpenGL ES 2.0 applivations you need to have package "libgles2-dev" installed. It is as standard, part of Fremantle aplha ARMEL but at the moment it is missing from x86 version. We try to get x86 equivalent OpenGL ES2 emulation library available soon.

There is excellent way to familiarize yourself to OpenGL ES 2.0 by trying the PoverVR tutorials that can be found form SDK under TrainingCouse directory. The examples have their own Makefiles for Linux host but you can copy the files to your own directory and try makefile below. Reason to use this own Makefile is thet the makefiles coming with SDK compiles examples with x86 libraries part of the SDK and not armel/x86 maemo libraries in scratchbox.

This Makefile at the moment supports the basic and PvrShell examples (01..05) but not yet support PvrTools exaples ( 06 and above ).

To compile some of PoverVR tutorial examples, you can use following Makefile

CC=g++

CPPFLAGS = -DBUILD_OGLES2
LDFLAGS=-lEGL -lX11 -lGLESv2 

all:OGLES2Texturing OGLES2BasicTnL OGLES2IntroducingPVRTools OGLES2HelloTriangle_LinuxX11

OGLES2HelloTriangle_LinuxX11:OGLES2HelloTriangle_LinuxX11.o

OGLES2Texturing: PVRShellOS.o OGLES2Texturing.o  PVRShell.o PVRShellAPI.o

OGLES2BasicTnL: PVRShellOS.o OGLES2BasicTnL.o  PVRShell.o PVRShellAPI.o

OGLES2IntroducingPVRTools: PVRShellOS.o OGLES2IntroducingPVRTools.o  PVRShell.o PVRShellAPI.o

Using with QGLWidget

There is in Qt 4.5 ready made example hellogl_es2 that can be found from examples/opengl/hellogl_es2 directory. There is also equivalent examples for desktop opengl and opengl_es2 .

The example is also good showing what is different between OpenGL versions. The hellogl uses plain desktop "glBegin / glEnd" functions with display lists. Hellogl_es2 uses vertex attribute pointers and shaders instead of glBegin/glEnd. The helloes_gl2 is even more complicated because it uses programmable shaders instead fixed pipeline in both of the previous exaples.

If you try compile yourself unmodified version of hellogl_es2 for maemo, you need to add in void GLWidget::initializeGL ()

Line in beginning
setlocale(LC_NUMERIC, "C"); // Reset locale for compilation
and after shaders has been compiled line
 setlocale(LC_ALL, ""); // restore locale

because locale affects in shader compilation even it should not do