GwyGLMaterial: Gwyddion Library Reference Manual

## GwyGLMaterial GwyGLMaterial — OpenGL material representation |

## Functions

const GwyRGBA * | gwy_gl_material_get_ambient ()
void | gwy_gl_material_set_ambient ()
const GwyRGBA * | gwy_gl_material_get_diffuse ()
void | gwy_gl_material_set_diffuse ()
const GwyRGBA * | gwy_gl_material_get_specular ()
void | gwy_gl_material_set_specular ()
const GwyRGBA * | gwy_gl_material_get_emission ()
void | gwy_gl_material_set_emission ()
gdouble | gwy_gl_material_get_shininess ()
void | gwy_gl_material_set_shininess ()
void | gwy_gl_material_reset ()
GwyInventory * | gwy_gl_materials ()
GwyGLMaterial * | gwy_gl_materials_get_gl_material ()

## Types and Values

#define | GWY_GL_MATERIAL_DEFAULT
#define | GWY_GL_MATERIAL_NONE
struct | GwyGLMaterial
struct | GwyGLMaterialClass

## Object Hierarchy

        GObject
        ╰── GwyResource
            ╰── GwyGLMaterial

## Implemented Interfaces

GwyGLMaterial implements GwySerializable.

## Includes

    #include <libgwyddion/gwyddion.h>

## Description

GwyGLMaterial represents an OpenGL material. Its properties directly map to corresponding OpenGL material characteristics, all are in the range [0,1].

Gradient objects can be obtained from `gwy_gl_materials_get_gl_material()`. New GL materials can be created with `gwy_inventory_new_item()` on the GwyInventory returned by `gwy_gl_materials()`.

## Functions

### gwy_gl_material_get_ambient()

    const GwyRGBA *
    gwy_gl_material_get_ambient (GwyGLMaterial *glmaterial);

Gets the ambient reflectance of a GL material.

#### Parameters

glmaterial | A GL material. |

#### Returns

Ambient reflectance (owned by GL material, must not be modified nor freed).

### gwy_gl_material_set_ambient()

    void
    gwy_gl_material_set_ambient (GwyGLMaterial *glmaterial,
                                 const GwyRGBA *ambient);

Sets the ambient reflectance of a GL material.

#### Parameters

glmaterial | A GL material. |
ambient | Ambient reflectance. |

### gwy_gl_material_get_diffuse()

    const GwyRGBA *
    gwy_gl_material_get_diffuse (GwyGLMaterial *glmaterial);

Gets the diffuse reflectance of a GL material.

#### Parameters

glmaterial | A GL material. |

#### Returns

Diffuse reflectance (owned by GL material, must not be modified nor freed).

### gwy_gl_material_set_diffuse()

    void
    gwy_gl_material_set_diffuse (GwyGLMaterial *glmaterial,
                                 const GwyRGBA *diffuse);

Sets the diffuse reflectance of a GL material.

#### Parameters

glmaterial | A GL material. |
diffuse | Diffuse reflectance. |

### gwy_gl_material_get_specular()

    const GwyRGBA *
    gwy_gl_material_get_specular (GwyGLMaterial *glmaterial);

Gets the specular reflectance of a GL material.

#### Parameters

glmaterial | A GL material. |

#### Returns

Specular reflectance (owned by GL material, must not be modified nor freed).

### gwy_gl_material_set_specular()

    void
    gwy_gl_material_set_specular (GwyGLMaterial *glmaterial,
                                  const GwyRGBA *specular);

Sets the specular reflectance of a GL material.

#### Parameters

glmaterial | A GL material. |
specular | Specular reflectance. |

### gwy_gl_material_get_emission()

    const GwyRGBA *
    gwy_gl_material_get_emission (GwyGLMaterial *glmaterial);

Gets the emission component of a GL material.

#### Parameters

glmaterial | A GL material. |

#### Returns

Emission component (owned by GL material, must not be modified nor freed).

### gwy_gl_material_set_emission()

    void
    gwy_gl_material_set_emission (GwyGLMaterial *glmaterial,
                                  const GwyRGBA *emission);

Sets the emission component of a GL material.

#### Parameters

glmaterial | A GL material. |
emission | Emission component. |

### gwy_gl_material_get_shininess()

    gdouble
    gwy_gl_material_get_shininess (GwyGLMaterial *glmaterial);

Gets the shininess value of a GL material.

#### Parameters

glmaterial | A GL material. |

#### Returns

The shininess value as a value in interval [0,1].

### gwy_gl_material_set_shininess()

    void
    gwy_gl_material_set_shininess (GwyGLMaterial *glmaterial,
                                   gdouble shininess);

Sets the shininess value of a GL material.

#### Parameters

glmaterial | A GL material. |
shininess | Shinniness value in interval [0,1]. |

### gwy_gl_material_reset()

    void
    gwy_gl_material_reset (GwyGLMaterial *glmaterial);

Resets a GL material to default values.

#### Parameters

glmaterial | A GL material. |

### gwy_gl_materials()

    GwyInventory *
    gwy_gl_materials (void);

Gets inventory with all the GL materials.

#### Returns

GL material inventory.

[transfer none]

### gwy_gl_materials_get_gl_material()

    GwyGLMaterial *
    gwy_gl_materials_get_gl_material (const gchar *name);

Convenience function to get a GL material from `gwy_gl_materials()` by name.

#### Parameters

name | GL material name. May be `NULL` to get the default GL material. | [nullable]

#### Returns

GL material identified by `name` or the default GL material if `name` does not exist.

[transfer none]

## Types and Values

### GWY_GL_MATERIAL_DEFAULT

    #define GWY_GL_MATERIAL_DEFAULT "OpenGL-Default"

The name of the default OpenGL material.

It is guaranteed to always exist.

Note this is not the same as user's default material which corresponds to the default item in `gwy_gl_materials()` inventory and it change over time.

### GWY_GL_MATERIAL_NONE

    #define GWY_GL_MATERIAL_NONE    "None"

The name of special void material with all characteristics zero.

It is guaranteed to exist, but you should rarely actually need it.

### struct GwyGLMaterial

    struct GwyGLMaterial;

### struct GwyGLMaterialClass

    struct GwyGLMaterialClass {
        GwyResourceClass parent_class;
    };

## See Also

Gwy3DView -- 3D data display widget, GwyRGBA -- representation of color components, GwyInventory -- the container holding all GL materials