## Utility API Utility API |

## Synopsis

    gboolean            cogl_create_context                 (void);
    void                cogl_destroy_context                (void);
    #define             COGL_INVALID_HANDLE
    typedef             CoglHandle;
    void                (*CoglFuncPtr)                      (void);

    enum                CoglFeatureFlags;
    ClutterFeatureFlags  cogl_get_features                  (void);
    gboolean            cogl_features_available             (CoglFeatureFlags features);

    CoglFuncPtr         cogl_get_proc_address               (const gchar *name);
    gboolean            cogl_check_extension                (const gchar *name,
                                                             const gchar *ext);
    void                cogl_get_bitmasks                   (gint *red,
                                                             gint *green,
                                                             gint *blue,
                                                             gint *alpha);
    void                cogl_paint_init                     (const ClutterColor *color);

    int                 cogl_util_next_p2                   (int a);

## Description

## Details

### cogl_create_context ()

    gboolean            cogl_create_context                 (void);

FIXME

Returns : |

### cogl_destroy_context ()

    void                cogl_destroy_context                (void);

FIXME

### COGL_INVALID_HANDLE

    #define COGL_INVALID_HANDLE NULL

A COGL handle that is not valid, used for unitialized handles as well as error conditions.

### CoglHandle

    typedef gpointer CoglHandle;

Type used for storing references to cogl objects, the CoglHandle is a fully opaque type without any public data members.

### CoglFuncPtr ()

    void                (*CoglFuncPtr)                      (void);

The type used by cogl for function pointers, note that this type is used as a generic catch-all cast for function pointers and the actual arguments and return type may be different.

### enum CoglFeatureFlags

    typedef enum
    {
      COGL_FEATURE_TEXTURE_RECTANGLE      = (1 << 1),
      COGL_FEATURE_TEXTURE_NPOT           = (1 << 2),
      COGL_FEATURE_TEXTURE_YUV            = (1 << 3),
      COGL_FEATURE_TEXTURE_READ_PIXELS    = (1 << 4),
      COGL_FEATURE_SHADERS_GLSL           = (1 << 5),
      COGL_FEATURE_OFFSCREEN              = (1 << 6),
      COGL_FEATURE_OFFSCREEN_MULTISAMPLE  = (1 << 7),
      COGL_FEATURE_OFFSCREEN_BLIT         = (1 << 8),
      COGL_FEATURE_FOUR_CLIP_PLANES       = (1 << 9),
      COGL_FEATURE_STENCIL_BUFFER         = (1 << 10)

    } CoglFeatureFlags;

Flags for the supported features.

### cogl_get_features ()

    ClutterFeatureFlags  cogl_get_features                  (void);

Returns all of the features supported by COGL.

Returns : | A logical OR of all the supported COGL features.

Since 0.8

### cogl_features_available ()

    gboolean            cogl_features_available             (CoglFeatureFlags features);

Checks whether the given COGL features are available. Multiple features can be checked for by or-ing them together with the '|' operator. `TRUE` is only returned if all of the requested features are available.

`features` : | A bitmask of features to check for
Returns : | `TRUE` if the features are available, `FALSE` otherwise.

### cogl_get_proc_address ()

    CoglFuncPtr         cogl_get_proc_address               (const gchar *name);

Gets a pointer to a given GL or GL ES extension function. This acts as a wrapper around `glXGetProcAddress()` or whatever is the appropriate function for the current backend.

`name` : | the name of the function.
Returns : | a pointer to the requested function or `NULL` if the function is not available.

### cogl_check_extension ()

    gboolean            cogl_check_extension                (const gchar *name,
                                                             const gchar *ext);

Check whether `name` occurs in list of extensions in `ext`.

`name` : | extension to check for
`ext` : | list of extensions
Returns : | `TRUE` if the extension occurs in the list, `FALSE` otherwize.

### cogl_get_bitmasks ()

    void                cogl_get_bitmasks                   (gint *red,
                                                             gint *green,
                                                             gint *blue,
                                                             gint *alpha);

Gets the number of bitplanes used for each of the color components in the color buffer. Pass `NULL` for any of the arguments if the value is not required.

`red` : | Return location for the number of red bits or `NULL`
`green` : | Return location for the number of green bits or `NULL`
`blue` : | Return location for the number of blue bits or `NULL`
`alpha` : | Return location for the number of alpha bits or `NULL`

### cogl_paint_init ()

    void                cogl_paint_init                     (const ClutterColor *color);

Clears the color buffer to `color`. The depth buffer and stencil buffers are also cleared and fogging and lighting are disabled.

`color` : | Background color to clear to

### cogl_util_next_p2 ()

    int                 cogl_util_next_p2                   (int a);

Calculates the next power greater than `a`.

`a` : | Value to get the next power
Returns : | The next power after `a`.