Start a new topic

fltGcLIghtMode

Original Post by: SCGrant327 Mon Aug 6 18:01:51 2012


How do we set/get this attribute?


Original Post by: SCGrant327 Mon Aug 6 18:22:15 2012


Too long away from the API. My blonde was blocking my view of the mgGetAttList and mgSetAttList functions.


:lol:

Original Post by: ChrisRogers Mon Aug 6 18:22:47 2012


Please be aware that in OpenFlight API 4.2's reference, there is a FAQ. In this FAQ, there is a section that answers this question in more detail than I can do here, so if you want a really good descriptive answer to this question complete with python and C examples, please visit the OpenFlight_API_Reference.htm. In case some people still do not have 4.2, I will try to answer this question below.


That attribute is an attribute on a polygon/mesh, so to set it you simply use the same functions you set all standard attributes with, mgSetAttList. You need to pay special attention to tye type when using this function and make sure the type you pass in to hold the value is the correct size... in this case unsigned char. You find out the size of the value by looking at the OpenFlight Data Dictionary Section of the OpenFlight API Reference. Here is an example of the information contained in the Data Dictionary for this attribute type:


unsigned char (1) fltGcLightMode Polygon lighting mode

0 = None (Flat)

1 = Gouraud

2 = Dynamic (Lit)

3 = Dynamic

This section tells you what size variable to use when getting or setting this data, as well as what the value's represent.


Here is an example of how to get and set this attribute from C code. Please note that in the example, I assume you have a polygon node and have named it 'rec'


mgSetAttList (rec, fltGcLightMode, 2, MG_NULL);


unsigned char mode = 0;

mgGetAttList (rec, fltGcLightMode, &mode;, MG_NULL);


I hope this helps!

Original Post by: ChrisRogers Mon Aug 6 18:25:26 2012


Too long away from the API...


It is good to have you back! Viva la API!

Login to post a comment