Hi David, On 6/15/06, david callu <[EMAIL PROTECTED]> wrote:
The problem is when i use introspection, i can't determine the string representation of a GLenum (or osg::StateAttribut::Mode)
The .osg wrapper has some hardwiring for mapping modes to strings, this isn't public though, if a mode doesn't match up its hardwired mapping in drops back to numberical form, this allows it to comfortably map all possible modes, even the ones it doens't know about.
I don't want to replace the type by the modes associated with them. I just when do an enum with osg::StateAttribute::GLMode, for all GLenum can be past to glEnable/glDisable function.
This would require a lot of modes to be put into one list, and it wouldn't be extensible.
>Implementing an enum for all the OpenGL modes simply isn't practical, >maintainable or extensibile - this is why its left up to use OpenGL >modes directly, as new modes are added to OpenGL then they all can >work natively without needing core OSG headers to be modified. ok, but with the osg::StateAttribute::Type you force the user to use specific attribute (all from OpenGL 2.0 and some from NVidia) When a new attribute is added to OpenGL, you must add it to the osg::StateAttribute::Type, and implenting a new class for this attribut So why not do the same process for the enum osg::StateAttribute::GLMode. Generally a new GLmode is add to OpenGL at the same time that a new Attribute, so core OSG headers must be modified for Attribute and for GLmode.
There are many more modes that attribute types, go browse through the OpenGL headers.
Moreover the class TextureGLModeSet is use to check if the mode is a TextureMode, this class must be maintain with the OpenGL evolution, this is exactly what you qualified of "isn't practical, maintainable or extensibile". With a enum osg::StateAttribute::GLMode and another enum osg::StateAttribute::GLTextureMode you solve this checking with a type check at compile time.
The extra code to detect Texture modes is a special case to try and catch incorrect usage, and isn't designed to be full proof, its just a test to help users catch common errors. Mapping all OpenGL modes to our own local enums might make you task easier, but it would make the rest of the OSG less maintainable and extensible. The design of StateAttribute and StateSet is like this deliberately to make it maintainable and extensible, and its been a success, I'm not about to throw this out. Robert. Robert. _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
