|Version 17 (modified by robert, 6 years ago)|
OpenGL ES Support
Note from Robert Osfield, October 30th 2009:
I have been commissioned to port the OpenSceneGraph to OpenGL ES 2.0. This work commenced on the 5th October 2009, and have over the past month been merging the port in OpenScenGraph subversion repository's trunk. OpenGL ES 1.1 support and OpenGL 3.x support is not directly part of the project, but my plan is the re-factor the OpenScenGraph build system and code base to enable relatively straight forward management of multiple OpenGL x.x and OpenGL ES x.x versions, and would welcome collaboration on support of these additional APIs as well as my core task of OpenGL ES 2.0 support.
As can be seen below most of the tasks have now been completed, and provisional OpenGL ES 1.1 and OpenGL ES 2.0 support is now checked into OpenSceneGraph svn/trunk. I'm now concentrating of testing and debugging the port, which once a few more elements have been fixed will be ready for widespread end user testing.
Areas of OpenSceneGraph code base that need refactoring
- CMake needs to be updated to check for OpenGL, OpenGL ES + GLU versions installed
- Need a compile time and run time scheme for checking for feature support.
- Need support for shader compilation and objects found in GLES 2.0.
Areas of OpenSceneGraph code base refactoring has now been completed
- All GLU related functions must be replaced or disabled.
- ModelView and Projection matrices need to be implemented using uniforms.
- glVertexPoint/glColorPointer etc. usages needs remapping to glVertexAttribPointer equivalents.
- glVertex/glColor etc. usages needs remapping to glVertexAttrib equivalents.
- Shaders need to be rewritten (potentially at shader compilation time) to use osg_ equivalents of gl_ built in uniforms.
- All usage of glBegin/glEnd needs replacing with vertex array based codes.
- Need to enumerate and then disable the OpenGL fixed function code implementation in various StateAttribute subclasses.
- Need to look at !OpenGL centric #define's that the OpenSceneGraph headers
- Optional disable of all OpenGL display lists codes
Completed Mini milestones
- Review OpenGL ES 2.0 specs, the ES 2.0 headers and emulator SDK from http://www.imaginationtechnologies.com/.
- Review OpenSceneGraph codebase with a view to pinpointing the potential obstacles to porting.
- Draw up plan for tackling port.
- Get a build of OpenSceneGraph that via CMake option does not build against GLU
- Write an OpenSceneGraph example that does not use the replaces the standard usage of gl_ModelViewMatrix and gl_ProjectMatrix with osg_ maintained equivalents. This will require osg::State to manage the uniforms automatically. Example is called osgvertexattributes and is already checked into svn/trunk.
- Modify the above example so that it uses OpenSceneGraph generated vertex attributes rather than gl_Vertex. This will require osg::State to remap the conventional vertex/colour arrays to vertex attrib equivalents.
- Modify all glBegin/glEnd code usage to use vertex array/vertex attrib arrays instead. Potentially we could use osg::State to mimic glBegin/glEnd usage, or cache an osg::Geometry to do this job for us.
- Modify all glVertex/glColor usage to use vertex attrib equivalents. Potentially we could use use osg::State to do the remapping for us.
- Implement an CMake option(s) that allows disabling of all fixed function StateAttribute::apply() methods that are unsupported by OpenGL ES 2.0 + OpenGL 3.x.
- Modify the include/osg/Config + include/GL to automatically pull in the correct version of GL/GLES that the OpenSceneGraph has been compiled against, and provide #define's that the OpenSceneGraph and end user applications can use to determine which GL type is compiled into the OpenSceneGraph libraries.
- Implement support for EGL in osgViewer.
- Modify osg::Shader to use OpenGL ES 2.0's shader object set up.
- Where possible modify shadeers supplied with OpenSceneGraph distribution or OpenSceneGraph-Data to work with OpenGL ES 2.0.
Mini milestones currently being tackled
OpenSceneGraph OpenGLES 2.0 testing and debugging phase
- Test OpenSceneGraph builds and runs against OpenGL 1.x, OpenGL 2.x targets i.e. we haven't broken compatibility with standard desktop systems
- Test OpenSceneGraph builds and runs against OpenGL ES 2.0 desktop emulators and embedded systems.