There is no clear "correct" answer for the material question.

OSG defaults to lighting enabled. In OpenGL parlance, this requires the presence of Materials. So what if a scene graph doesn't contain a material? OSG gets around this issue by enabling GL_COLOR_MATERIAL, which means that materials track the value of the OpenGL primary color variable. So, in effect, your scene graph does indeed have a material: it's implicit, and taken from the primary color.

To reproduce this in OpenFlight, the exporter (attempts to) use the color of the geometry in your scene graph to create a value for the OpenFlight materials.

If this is not what you prefer, or if it's broke in some way, or if you have a different idea for making this feature-mismatch work better, then you're free to implement it and submit it. I recommend you use an Option to enable this behavior, and leave the current behavior as the default, to ensure you don't break existing applications.

Regarding setting colors, see the OpenFlight spec. Colors can be explicit or indexed. If the index is -1, the color is explicit.

Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466



Katharina Plugge wrote:
Hi,

when exporting from osg to flt the OpenFlight-Plugin is adding a Material to 
every StateSet even if there was no Material defined before. After a look in 
the source code I found out two things:

1) In file ExpGeometryRecords.cpp line 235 a material (index) is generated even 
if the material of the stateset is set to OFF. (I do not know if this is really 
wanted)

2) File FltExportVisitor.cpp line 86: The constructor of FltExportVisitor 
initializes a default StateSet which has a material assigned even though it is 
set to OFF. This material is attached to every node's StateSet, when merging 
the parent StateSet with its own  (happens in pushStateSet of 
FltExportVisitor). Because of 1) it gets also in the final flt-File, which is 
definitly not wanted (at least by me).

To solve this problem you could either change adding of materials which are set to OFF or you could remove the default material from the default StateSet. Or do both. I am not quite sure, which way would be the best...?! (Would be great if someone whith better understanding could fix this. Its only a small change in code. Thanks!)


Also it seems that when exporting to OpenFlight a primaryColor is set, but no 
index (index is always -1). Shouldn't there be a Reference to a color Palette?


Cheers,
Katharina

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17524#17524





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to