IGlobe::AddLayerType really appears to be the only method that will properly initialize a feature layer for use with a Globe. Adding an IFeatureLayer object directly to an existing IGroupLayer object does not initialize the feature layer object properly.
About your code:
My code:
m_GroupLayer ---> grouplayer (IgroupLayer)
pFLy --> featurelayer (IFeatureLayer)
m_objGlobeControl --> globecontrol
' ---------------------------------------------------------------------- First time Add FeatureLayer and GroupLayer, and Add GroupLayer to GLobe
'>> Here you add a feature layer to a group layer
m_GroupLayer.Add(pFLy)
'>> Here you add the group layer to the globe using IGlobe::AddLayer. This initializes properly any feature layers in the group layer object being added.
m_objGlobeControl.Globe.AddLayerType(m_GroupLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, True)
TryCast(m_objGlobeControl.GlobeDisplay, IGlobeDisplayLayers).RefreshLayer(m_GroupLayer)
' ---------------------------------------------------------------------- Second time add other FeatureLayer to GroupLayer
'>> Here you add another feature layer but directly to the existing group layer of the globe, but this does not initialize the feature layer properly for use with globe.
'>> We can see this better if using similar program code in an ArcGlobe custom command or add-in button. The feature layer that got added to the exiting group
'>> layer is missing all the Layer Properties tabs that are indicative of a draped, globe layer.
m_GroupLayer.Add(pFLy)
TryCast(m_objGlobeControl.GlobeDisplay, IGlobeDisplayLayers).RefreshLayer(m_GroupLayer)
I would do one of the following workarounds:
1. Reconstruct the group layer progammatically if you need to add more layers to an existing group layer > delete the existing group layer > and add the newly constructed group layer with all the sub layers inside of it which now includes the new layer you wanted to add, using the same code you used to add the group layer first:
m_objGlobeControl.Globe.AddLayerType(m_GroupLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, True)
or,
2. Add the IFeatureLayer you want to add to the existing group layer directly to the globe using IGlobe::AddLayerType. This will initialize the layer as a draped, globe layer so it can display properly, but the feature layer will not be in the group layer. Programmatically "move" the newly added layer to the group layer as shown below. Unfortunately, the MoveLayer() method of IMap and IScene which you can use with a Globe will not move a layer inside a group layer. Also, the Globe object cannot be casted to IMapLayers in order to use IMapLayers.InsertLayerInGroup method so we cannot choose in which position within a group layer to insert a layer. Only the Map and Scene object can be casted to IMapLayers . With these shotcomings in mind, I only see the possibility of achieving the "move" by:
a. Add a feature layer to the globe using IGlobe::AddLayerType, e.g.
axGlobeControl1.Globe.AddLayerType(pLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, true);
The layer displays/initialized correctly but is not inside the group layer
b. Remove the same layer from the globe. The pLayer object however still lives in memory so it can be still be referenced.
(axGlobeControl1.Globe as IScene).DeleteLayer(pLayer);
The layer has been removed from the globe
c. Now add the layer to the group layer and refresh as you are already doing
m_GroupLayer.Add(pLayer);
(axGlobeControl1.GlobeDisplay as IGlobeDisplayLayers).RefreshLayer(m_GroupLayer);