Hi Paul,

On Wed, Oct 28, 2009 at 6:48 PM, Paul Martz <pma...@skew-matrix.com> wrote:
> Working on GL3 as of today. I have a few days available to start the
> investigation, and if things go well, I can table other work to keep
> plugging at GL3.

Great news.  A couple of tips to help you along the way/understand how
I've gone about the GLES 1.1/GLES 2.0.

First up the root CMakeLists.txt now has a series of controls that
allow to disable various OpenGL features, these CMake controls set the
#define's of the same name in the autogenerted include/osg/Config
file:

#define OSG_GLU_AVAILABLE
#define OSG_GL1_AVAILABLE
#define OSG_GL2_AVAILABLE
/* #undef OSG_GL3_AVAILABLE */
/* #undef OSG_GLES1_AVAILABLE */
/* #undef OSG_GLES2_AVAILABLE */
#define OSG_GL_DISPLAYLISTS_AVAILABLE
#define OSG_GL_MATRICES_AVAILABLE
#define OSG_GL_VERTEX_FUNCS_AVAILABLE
#define OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
#define OSG_GL_FIXED_FUNCTION_AVAILABLE

In the case of GL3 you'll want to set the following CMake vars:

OSG_GLU_AVAILABLE to OFF
OSG_GL1_AVAILABLE to OFF
OSG_GL2_AVAILABLE to OFF
OSG_GL3_AVAILABLE to ON
OSG_GLES1_AVAILABLE to OFF (default)
OSG_GLES2_AVAILABLE to OFF (default)
OSG_GL_DISPLAYLISTS_AVAILABLE to OFF
OSG_GL_MATRICES_AVAILABLE to OFF
OSG_GL_VERTEX_FUNCS_AVAILABLE to OFF
OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE to OFF
OSG_GL_FIXED_FUNCTION_AVAILABLE to OFF

You may well need to modify include/osg/GL to pick up on the GL3
header if it's different than gl.h.

Also have a look at the osgvertexattributes example, as it enables the
aliasing of vertex attributes and projection/modelview projection
matrix uniforms.  The aliasing also renames the shader variables
gl_Vertex/gl_Color/etc and gl_ProjectionMatrix/gl_ModelViewMatrix/etc.
to osg_ equivilant and adds in uniform/attribute declarations for
them, as well as populates the required for them.

osgViewer will also need mods to support the GL3 context.

I'm about to check in a series of mods to enable compilation of the
all the OSG NodeKit, utility libs (osgUtil, osgDB, osgGA) and the
plugins against OpenGLES 1.1 and OpenGLES 2.0.  I haven't yet ported
osgViewer to work with EGL yet, osgViewer save for the
GraphicsWindow/PixelBuffer files all compile though.

Given how close OpenGL 3.x and OpenGLES 2.0 are in feature set I would
expect that it shouldn't require too many more changes to get things
compiling against OpenGL 3.x.  What changes will be required should be
able to follow the approach I've taken for ES support.  Thankfully the
OpenGL code hasn't become spaghetti code, at least so far... :-)

Once I get the EGL support added to osgViewer I'll be able to test
runtime against OpenGL ES 2.0, which will mark the testing, debugging
and learning process.  I say learning process as doing without any the
fixed function pipeline and coding everything with shaders will be
interesting.  The osgUtil::ShaderGen class will help a little (as the
osgvertexattributes example illustrates) but there is still a lot of
functionality that will be missing thanks to the lack of fixed
function pipeline.

Cheers,
Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to