### Constructor

# Cogl Texture2D new_with_format

since: 2.0

#### Declaration [src]

    CoglTexture*
    cogl_texture_2d_new_with_format (
      CoglContext* ctx,
      int width,
      int height,
      CoglPixelFormat format
    )

#### Description [src]

Creates a low-level `CoglTexture2D` texture with a given `width` and `height` that your GPU can texture from directly.

The storage for the texture is not allocated before this function returns. You can call `cogl_texture_allocate()` to explicitly allocate the underlying storage or preferably let Cogl automatically allocate storage lazily when it may know more about how the texture is being used and can optimize how it is allocated.

The texture is still configurable until it has been allocated so for example you can influence the internal format of the texture using `cogl_texture_set_components()` and cogl_texture_set_premultiplied().

Available since: 2.0

#### Parameters

`ctx`

  Type: `CoglContext`

  A `CoglContext`.

  The data is owned by the caller of the function.

`width`

  Type: `int`

  Width of the texture to allocate.

`height`

  Type: `int`

  Height of the texture to allocate.

`format`

  Type: `CoglPixelFormat`

  Format of the texture to allocate.

#### Return value

Type: `CoglTexture`

A new `CoglTexture2D` object with no storage yet allocated.

The caller of the function takes ownership of the data, and is responsible for freeing it.