## GwyGLView

GwyGLView — OpenGL 3D data display

## Functions

GtkWidget * | gwy_gl_view_new ()
const gchar * | gwy_gl_view_get_setup_prefix ()
void | gwy_gl_view_set_setup_prefix ()
const gchar * | gwy_gl_view_get_data_key ()
void | gwy_gl_view_set_data_key ()
const gchar * | gwy_gl_view_get_gradient_key ()
void | gwy_gl_view_set_gradient_key ()
const gchar * | gwy_gl_view_get_material_key ()
void | gwy_gl_view_set_material_key ()
guint | gwy_gl_view_get_reduced_size ()
void | gwy_gl_view_set_reduced_size ()
GwyGLMovement | gwy_gl_view_get_movement_type ()
void | gwy_gl_view_set_movement_type ()
GdkPixbuf * | gwy_gl_view_get_pixbuf ()
GdkPixbuf * | gwy_gl_view_get_pixbuf_with_alpha ()
GwyGLLabel * | gwy_gl_view_get_label ()
GwyGLSetup * | gwy_gl_view_get_setup ()
GwyDict * | gwy_gl_view_get_data ()
void | gwy_gl_view_get_scale_range ()
void | gwy_gl_view_set_scale_range ()
void | gwy_gl_view_class_disable_axis_drawing ()
const gchar * | gwy_gl_view_get_mask_key ()
void | gwy_gl_view_set_mask_key ()

## Types and Values

struct | GwyGLView
struct | GwyGLViewClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GwyGLView

## Implemented Interfaces

GwyGLView implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <libgwyui/gwyui.h>

## Description

GwyGLView displays a data field as a threedimensional heightfield using OpenGL. You can create a new OpenGL view for a data container with `gwy_gl_view_new()`. By default, it inherits properties like palette from data view settings, but supports separate settings -- see `gwy_gl_view_set_gradient_key()` et al.

GwyGLView allows the user to interactively rotate, scale, z-scale the data or move lights, depending on its movement state. There are no controls provided for mode change, you have to provide some yourself and set the movement mode with `gwy_gl_view_set_movement_type()`.

## Functions

### gwy_gl_view_new()

    GtkWidget *
    gwy_gl_view_new (GwyDict *data);

Creates a new threedimensional OpenGL display of `data` .

The widget is initialized from container `data` .

#### Parameters

data | A GwyDict containing the data to display. |

#### Returns

The new OpenGL 3D widget as a GtkWidget.

### gwy_gl_view_get_setup_prefix()

    const gchar *
    gwy_gl_view_get_setup_prefix (GwyGLView *glview);

Gets prefix identifying OpenGL view setup in the container.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The setup key prefix.

### gwy_gl_view_set_setup_prefix()

    void
    gwy_gl_view_set_setup_prefix (GwyGLView *glview,
                                  const gchar *key);

Sets the prefix of OpenGL view parameters in the container.

#### Parameters

glview | An OpenGL data view widget. |
key | Container string prefix for keys identifying the view setup parameters. The GwyGLSetup is stored at key `"/setup"` under this prefix. Label objects are also stored under this prefix. |

### gwy_gl_view_get_data_key()

    const gchar *
    gwy_gl_view_get_data_key (GwyGLView *glview);

Gets the container key identifying the data field to visualize in an OpenGL view.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The string key, or `NULL` if it isn't set.

### gwy_gl_view_set_data_key()

    void
    gwy_gl_view_set_data_key (GwyGLView *glview,
                              const gchar *key);

Sets the container key identifying the data field to visualize in an OpenGL view.

#### Parameters

glview | An OpenGL data view widget. |
key | Container string key identifying the data field to visualize. |

### gwy_gl_view_get_gradient_key()

    const gchar *
    gwy_gl_view_get_gradient_key (GwyGLView *glview);

Gets the container key identifying the colour gradient used to visualize data in an OpenGL view.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The string key, or `NULL` if it isn't set.

### gwy_gl_view_set_gradient_key()

    void
    gwy_gl_view_set_gradient_key (GwyGLView *glview,
                                  const gchar *key);

Sets the container key identifying the color gradient to use to visualize data in an OpenGL view.

#### Parameters

glview | An OpenGL data view widget. |
key | Container string key identifying the color gradient to use for gradient visualization mode. |

### gwy_gl_view_get_material_key()

    const gchar *
    gwy_gl_view_get_material_key (GwyGLView *glview);

Gets the key identifying the GL material used to visualize data in a 3D view.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The string key, or `NULL` if it isn't set.

### gwy_gl_view_set_material_key()

    void
    gwy_gl_view_set_material_key (GwyGLView *glview,
                                  const gchar *key);

Sets the container key of the GL material used to visualize data in an OpenGL view.

#### Parameters

glview | An OpenGL data view widget. |
key | Container string key identifying the color material to use for material visualization mode. |

### gwy_gl_view_get_reduced_size()

    guint
    gwy_gl_view_get_reduced_size (GwyGLView *glview);

Returns the reduced data size of an OpenGL view.

See `gwy_gl_view_set_reduced_size()` for details.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The reduced data size.

Note since 2.44 the reduced size has no influence because the OpenGL view does not downsample anything.

### gwy_gl_view_set_reduced_size()

    void
    gwy_gl_view_set_reduced_size (GwyGLView *glview,
                                  guint reduced_size);

Sets the reduced data size of an OpenGL view.

Data larger than reduced size may be shown downsampled during transforms and other changes to speed up the rendering. Final, full-size rendering is then performed after a timeout.

In case of the original data are not square, the `reduced_size` is the greater size of the downsampled data, the other dimension is proportional to the original size.

Changes in reduced size do not cause immediate redraw when an operation is pending and the view is shown in reduced size. It only affects future downsampling.

Note since 2.44 the reduced size has no influence because the OpenGL view does not downsample anything.

#### Parameters

glview | An OpenGL data view widget. |
reduced_size | New reduced data size. |

### gwy_gl_view_get_movement_type()

    GwyGLMovement
    gwy_gl_view_get_movement_type (GwyGLView *glview);

Returns a movement type describing actual type of response on the mouse motion event.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

Actual type of response on the mouse motion event

### gwy_gl_view_set_movement_type()

    void
    gwy_gl_view_set_movement_type (GwyGLView *glview,
                                   GwyGLMovement movement);

Sets the type of widget response on the mouse motion event.

#### Parameters

glview | An OpenGL data view widget. |
movement | A new type of response on the mouse motion event. |

### gwy_gl_view_get_pixbuf()

    GdkPixbuf *
    gwy_gl_view_get_pixbuf (GwyGLView *glview);

Copies the contents of the OpenGL view framebuffer to a GdkPixbuf.

The size of the pixbuf is indentical to the size of the widget.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

A newly allocated GdkPixbuf a copy of the framebuffer.

### gwy_gl_view_get_pixbuf_with_alpha()

    GdkPixbuf *
    gwy_gl_view_get_pixbuf_with_alpha (GwyGLView *glview);

Creates a GdkPixbuf from the contents of the OpenGL view framebuffer, with transparent background.

The size of the pixbuf is indentical to the size of the widget.

The rendered surface is cut perfectly. However, if the scene contains also antialiased labels, these are cut in a way which currently only works with a white background.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

A newly allocated GdkPixbuf a copy of the framebuffer.

### gwy_gl_view_get_label()

    GwyGLLabel *
    gwy_gl_view_get_label (GwyGLView *glview,
                           GwyGLViewLabel label);

Gets requested 3D label object of an OpenGL view.

This is a convenience method that can be used instead of fetching the label object from the data container.

#### Parameters

glview | An OpenGL data view widget. |
label | Label type to obtain. |

#### Returns

The 3D label object representing `label` in `glview` .

### gwy_gl_view_get_setup()

    GwyGLSetup *
    gwy_gl_view_get_setup (GwyGLView *glview);

Gets the 3D setup object of an OpenGL view.

This is a convenience method that can be used instead of fetching the setup object from the data container.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The corresponding 3D setup.

### gwy_gl_view_get_data()

    GwyDict *
    gwy_gl_view_get_data (GwyGLView *glview);

Returns the data container this OpenGL view displays.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The container as a GwyDict.

### gwy_gl_view_get_scale_range()

    void
    gwy_gl_view_get_scale_range (GwyGLView *glview,
                                 gdouble *min_scale,
                                 gdouble *max_scale);

Obtains the minimum and maximum zoom of a 3D data view

#### Parameters

glview | An OpenGL data view widget. |
min_scale | Location to put minimum scale, or `NULL`. |
max_scale | Location to put maximum scale, or `NULL`. |

### gwy_gl_view_set_scale_range()

    void
    gwy_gl_view_set_scale_range (GwyGLView *glview,
                                 gdouble min_scale,
                                 gdouble max_scale);

Sets the minimum and maximum zoom of a 3D data view.

Recommended zoom values are 0.5 - 5.0.

#### Parameters

glview | An OpenGL data view widget. |
min_scale | Minimum zoom of the 3D data view, pass 0.0 to keep the current value. |
max_scale | Maximum zoom of the 3D data view, pass 0.0 to keep the current value. |

### gwy_gl_view_class_disable_axis_drawing()

    void
    gwy_gl_view_class_disable_axis_drawing
                                   (gboolean disable);

Globally disables drawing of OpenGL view axes.

If axis drawing is disabled, axes are never drawn. If it is not disabled, their rendering depends on the OpenGL view setup.

This function is a hack and exists to work around various GL implementations that crash on pixmap drawing operations.

#### Parameters

disable | `TRUE` to disable OpenGL view axes globally, `FALSE` to enable them. |

### gwy_gl_view_get_mask_key()

    const gchar *
    gwy_gl_view_get_mask_key (GwyGLView *glview);

Gets the container key identifying the mask field for visualisation in an OpenGL view.

#### Parameters

glview | An OpenGL data view widget. |

#### Returns

The string key, or `NULL` if it isn't set.

### gwy_gl_view_set_mask_key()

    void
    gwy_gl_view_set_mask_key (GwyGLView *glview,
                              const gchar *key);

Sets the container key identifying the mask field for visualisation in an OpenGL view.

#### Parameters

glview | An OpenGL data view widget. |
key | Container string key identifying the mask field for visualisation |

## Types and Values

### struct GwyGLView

    struct GwyGLView;

### struct GwyGLViewClass

    struct GwyGLViewClass {
        GtkWidgetClass parent_class;

        void (*reserved1)(void);
        void (*reserved2)(void);
        void (*reserved3)(void);
        void (*reserved4)(void);
        void (*reserved5)(void);
        void (*reserved6)(void);
    };

## See Also

GwyGLWindow -- window combining OpenGL view with controls, GwyGLMaterial -- OpenGL materials, GwyGLLabel -- Labels on OpenGL view, GwyGLSetup -- 3D scene setup