~/imallett (Ian Mallett)

OpenGL Texture Terminology

OpenGL textures are extremely important. Unfortunately, what goes into making them is poorly explained. There are a lot of terms that have been bandied around, and they are not used consistently. The better resources (e.g. via opengl.org wiki) are indeed better, but are still not fully internally consistent. Additionally, everything I've seen suffers for want of pictures. In the following, I'll try to improve these issues.

[Disclaimer: although I have done a substantial amount of background research and filtered out a self-consistent set of terminology that I think is also accurate, I am not a primary source, and I am not fully confident my usage is absolutely perfect, especially with all the copy+paste. As always, your corrections/improvements are welcome. See also here.]

Here's a list of the terminology to untangle. Refer to the pictures as you go.

  • Image:
    A 1D, 2D, or 3D block of texels. Not to be confused with texture.
  • Texture:
    A collection of images, plus some minor state including default sampling configuration. Not to be confused with image.
  • Mipmap/Mipmap Chain: Non-multisample textures only
    I assume you know the basic idea of a mipmap. For a more technical definition, there are several, but I think the most sensible is "A sequence of MIP reductions of a single image". Each reduction is another image of the same format but progressively smaller size. If the resolution of one side of an image at reduction \(i\) is \(n_i\), then \(n_{i+1}=\max(n_i/2,1)\). When the resolution of all sides is \(1\), you can't add another reduction level (although you could have fewer levels: as few as one—the original).
  • Layer/Slice: Array textures only
    An ordered list of images; an element of an image array. For most kinds of textures, in each layer, there is only one image (and mipmap chain, if it exists) in this list.
  • Mipmap Level: Non-multisample textures only
    Various definitions, but I think the most sensible is "A single MIP level of all mipmap chains in a texture, cutting across all layers". The images of a mipmap level all have the same size and format, but potentially different contents.
  • Level-Layer: Non-multisample array textures only
    The images selected as being both in a particular layer and in a particular mipmap level. Nonstandard term.
  • Image Array/Layered Image: Array textures only
    An ordered list of level-layers. You can view this as a list of level-layers, each with some number of images, or simply as a flat array of images directly.
  • Face: Cubemap textures only:
    The image (and mipmap chain, if it exists) within a cubemap texture's single layer corresponding to a cardinal direction in a cubemap (there are six).
  • Layer-Face: Cubemap-array textures only:
    The image (and mipmap chain, if it exists) within a layer of a cubemap array texture
    corresponding to a cardinal direction in a cubemap (there are six per layer, however many layers there are).
  • Storage:
    The backing data store of a texture, comprising enough space to hold all images. Can be 1D, 2D, or 3D depending on the requirements of an image array. For example, a 2D array texture and a 3D texture both require 3D storage. Note: the presence of mipmap chains doesn't enter into the dimensionality required.

There are several kinds of textures in OpenGL, and I'll provide a diagram of the terminology for each. For the most general case, see the 2D cubemap array texture; the others can be understood as special cases of it.

  • GL_TEXTURE_1D: 1D texture (non-array, non-multisampled, allows mipmaps, 1D storage).
          [ ASCII art diagram, 1D texture                 ]
          [ A 4-wide map with full mipmap (three levels)  ]
      ┌───────────────┐
      │ ┌───────────┐ │
      │ │ ╔═╦═╦═╦═╗ ├─┼─ "Mipmap"/"Mipmap Chain" (same as texture,
      │ │ ╚═╩═╩═╩═╝ │ │  but without texture's internal state)
      │ │ ┌───────┐ │ │
      │ │ │ ╔═╦═╗ ├─┼─┼─ "Image"
      │ │ │ ╚═╩═╝ │ │ │
      │ │ └───────┘ │ ├─ "Texture"
      │ │    ╔═╗    │ │
      │ │    ╚═╝    │ │
      │ └───────────┘ │
      └───────────────┘
    	
  • GL_TEXTURE_RECTANGLE: Nowadays, almost identical to GL_TEXTURE_2D.
  • GL_TEXTURE_2D: 2D texture (non-array, non-multisampled, allows mipmaps, 2D storage).
          [ ASCII art diagram, 2D or rectangle texture ]
          [ A 4x4 map with full mipmap (three levels)  ]
      ┌───────────────┐
      │ ┌───────────┐ ├─ "Texture"
      │ │ ╔═╦═╦═╦═╗ │ │
      │ │ ╠═╬═╬═╬═╣ │ │
      │ │ ╠═╬═╬═╬═╣ ├─┼─ "Mipmap"/"Mipmap Chain" (same as texture,
      │ │ ╠═╬═╬═╬═╣ │ │  but without texture's internal state)
      │ │ ╚═╩═╩═╩═╝ │ │
      │ │ ┌───────┐ │ │
      │ │ │ ╔═╦═╗ │ │ │
      │ │ │ ╠═╬═╣ ├─┼─┼─ "Image"
      │ │ │ ╚═╩═╝ │ │ │
      │ │ └───────┘ │ │
      │ │    ╔═╗    │ │
      │ │    ╚═╝    │ │
      │ └───────────┘ │
      └───────────────┘
    	
  • GL_TEXTURE_3D: 3D texture (non-array (although stored as array), non-multisampled, allows mipmaps, 3D storage).
          [ ASCII art diagram, 3D texture                ]
          [ A 4x4x4 map, with full mipmap (three levels) ]
                     ┌─ "Layer" / "Slice" of array; one 2D layer of the 3D texture
      ┌─ "Texture" ──┼────────────────────────────────────────┐
      │   ┌──────────┴┐                                       │
      │ ┌─┼───────────┼─────────────────────────────────────┐ │
      │ │ │ ╔═╦═╦═╦═╗ │ ╔═╦═╦═╦═╗   ╔═╦═╦═╦═╗   ╔═╦═╦═╦═╗   ├─┼── "Image Array" /
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   │ │   "Layered Image" /
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   │ │   "Mipmap Level"
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   │ │
      │ │ │ ╚═╩═╩═╩═╝ │ ╚═╩═╩═╩═╝   ╚═╩═╩═╩═╝   ╚═╩═╩═╩═╝   │ │
      │ └─┼───────────┼─────────────────────────────────────┘ │
      │   │           │             ┌───────┐                 │
      │   │   ╔═╦═╗   │   ╔═╦═╗     │ ╔═╦═╗ │     ╔═╦═╗       │
      │   │   ╠═╬═╣   │   ╠═╬═╣     │ ╠═╬═╣ │     ╠═╬═╣       │
      │   │   ╚═╩═╝   │   ╚═╩═╝     │ ╚═╩═╝ │     ╚═╩═╝       │
      │   │           │             └───┬───┘                 │
      │   │           │                 └── "Image"           │
      │   │    ╔═╗    │    ╔═╗         ╔═╗         ╔═╗        │
      │   │    ╚═╝    │    ╚═╝         ╚═╝         ╚═╝        │
      │   │           │                                       │
      │   └───────────┘<─┐                                    │
      └──────────────────┼────────────────────────────────────┘
                         │ ^
                         └┬┘
      [ "Mipmap"/"Mipmap Chain": usage depends on context; can refer    ]
      [ to that of a single layer or to every chain; the whole texture. ]
    	
  • GL_TEXTURE_1D_ARRAY: 1D texture (array, non-multisampled, allows mipmaps, 2D storage (array of layers)).
          [ ASCII art diagram, 1D array texture                   ]
          [ Two 4-wide maps, each with full mipmap (three levels) ]
            ┌─ "Layer" / "Slice" of array
      ┌─────┼─────────────────────────┐
      │   ┌─┴─────────┐               ├─ "Texture"
      │ ┌─┼───────────┼─────────────┐ │
      │ │ │ ╔═╦═╦═╦═╗ │ ╔═╦═╦═╦═╗   ├─┼── "Image Array" /
      │ │ │ ╚═╩═╩═╩═╝ │ ╚═╩═╩═╩═╝   │ │   "Layered Image" /
      │ └─┼───────────┼─────────────┘ │   "Mipmap Level"
      │   │           │ ┌───────┐     │
      │   │   ╔═╦═╗   │ │ ╔═╦═╗ ├─────┼── "Image"
      │   │   ╚═╩═╝   │ │ ╚═╩═╝ │     │
      │   │           │ └───────┘     │
      │   │           │               │
      │   │    ╔═╗    │    ╔═╗        │
      │   │    ╚═╝    │    ╚═╝        │
      │   │           │               │
      │   └───────────┘ <─────┬─────> │
      └───────────────────────┼───────┘
                              │
      [ "Mipmap"/"Mipmap Chain": usage depends on context; can refer    ]
      [ to that of a single layer or to every chain; the whole texture. ]
    	
  • GL_TEXTURE_2D_ARRAY: 2D texture (array, non-multisampled, allows mipmaps, 3D storage (array of layers)).
          [ ASCII art diagram, 2D array texture                ]
          [ Two 4x4 maps, each with full mipmap (three levels) ]
            ┌─ "Layer" / "Slice" of array
      ┌─────┼─────────────────────────┐
      │   ┌─┴─────────┐               ├─ "Texture"
      │ ┌─┼───────────┼─────────────┐ │
      │ │ │ ╔═╦═╦═╦═╗ │ ╔═╦═╦═╦═╗   ├─┼── "Image Array" /
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   │ │   "Layered Image" /
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   │ │   "Mipmap Level"
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   │ │
      │ │ │ ╚═╩═╩═╩═╝ │ ╚═╩═╩═╩═╝   │ │
      │ └─┼───────────┼─────────────┘ │
      │   │           │ ┌───────┐     │
      │   │   ╔═╦═╗   │ │ ╔═╦═╗ ├─────┼── "Image"
      │   │   ╠═╬═╣   │ │ ╠═╬═╣ │     │
      │   │   ╚═╩═╝   │ │ ╚═╩═╝ │     │
      │   │           │ └───────┘     │
      │   │           │               │
      │   │    ╔═╗    │    ╔═╗        │
      │   │    ╚═╝    │    ╚═╝        │
      │   │           │               │
      │   └───────────┘ <─────┬─────> │
      └───────────────────────┼───────┘
                              │
      [ "Mipmap"/"Mipmap Chain": usage depends on context; can refer    ]
      [ to that of a single layer or to every chain; the whole texture. ]
    	
  • GL_TEXTURE_CUBE_MAP: 2D texture (non-array (although stored as array), non-multisampled, allows mipmaps, 3D storage (array of faces, length 6)).
          [ ASCII art diagram, cubemap texture            ]
          [ A 4x4 cubemap with full mipmap (three levels) ]
            ┌─ "Face" / "Layer" / "Slice" of array
      ┌─────┼─────────────────────────────────────────────────────────────────────────┐
      │   ┌─┴─────────┐                                                               ├─ "Texture"
      │ ┌─┼───────────┼─────────────────────────────────────────────────────────────┐ │
      │ │ │ ╔═╦═╦═╦═╗ │ ╔═╦═╦═╦═╗   ╔═╦═╦═╦═╗   ╔═╦═╦═╦═╗   ╔═╦═╦═╦═╗   ╔═╦═╦═╦═╗   ├─┼── "Image Array" /
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   │ │   "Layered Image" /
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   │ │   "Mipmap Level"
      │ │ │ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   ╠═╬═╬═╬═╣   │ │
      │ │ │ ╚═╩═╩═╩═╝ │ ╚═╩═╩═╩═╝   ╚═╩═╩═╩═╝   ╚═╩═╩═╩═╝   ╚═╩═╩═╩═╝   ╚═╩═╩═╩═╝   │ │
      │ └─┼───────────┼─────────────────────────────────────────────────────────────┘ │
      │   │           │ ┌───────┐                                                     │
      │   │   ╔═╦═╗   │ │ ╔═╦═╗ │     ╔═╦═╗       ╔═╦═╗       ╔═╦═╗       ╔═╦═╗       │
      │   │   ╠═╬═╣   │ │ ╠═╬═╣ │     ╠═╬═╣       ╠═╬═╣       ╠═╬═╣       ╠═╬═╣       │
      │   │   ╚═╩═╝   │ │ ╚═╩═╝ │     ╚═╩═╝       ╚═╩═╝       ╚═╩═╝       ╚═╩═╝       │
      │   │           │ └───┬───┘                                                     │
      │   │           │     └── "Image"                                               │
      │   │    ╔═╗    │    ╔═╗         ╔═╗         ╔═╗         ╔═╗         ╔═╗        │
      │   │    ╚═╝    │    ╚═╝         ╚═╝         ╚═╝         ╚═╝         ╚═╝        │
      │   │           │                                                               │
      │   └───────────┘ <─┐                                                           │
      └───────────────────┼───────────────────────────────────────────────────────────┘
                          │ ^
                          └┬┘
      ["Mipmap"/"Mipmap Chain": usage depends on context; can ]
      [ refer to a face or to every chain; the whole texture. ]
    	
  • GL_TEXTURE_CUBE_MAP_ARRAY: 2D texture (array, non-multisampled, allows mipmaps, 3D storage (array of faces, length divisible by 6)).
          [ ASCII art diagram, cubemap array texture                   ]
          [ Two cubemaps, each 4x4 and with full mipmap (three levels) ]                               "Layer-Face"          "Image"
      ┌─ "Texture" ─────────────────────────────────────────────────────────────────────────────────────────┼───────────────────┼─────────┐
      │   ┌─ "Layer" / "Slice" of array ────────────────────────────────┐                              ┌────┴────┐              │         │
      │ ┌─┼─ "Image Array" / "Layered Image" / "Mipmap Level" ──────────┼──────────────────────────────┼─────────┼──────────────┼───────┐ │
      │ │ │                                                             │                              │         │         ┌────┴────┐  │ │
      │ │ │ ╔═╦═╦═╦═╗ ╔═╦═╦═╦═╗ ╔═╦═╦═╦═╗ ╔═╦═╦═╦═╗ ╔═╦═╦═╦═╗ ╔═╦═╦═╦═╗ │ ╔═╦═╦═╦═╗ ╔═╦═╦═╦═╗ ╔═╦═╦═╦═╗│╔═╦═╦═╦═╗│╔═╦═╦═╦═╗│╔═╦═╦═╦═╗│  │ │
      │ │ │ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│  │ │
      │ │ │ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│  │ │
      │ │ │ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ │ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣ ╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│╠═╬═╬═╬═╣│  │ │
      │ │ │ ╚═╩═╩═╩═╝ ╚═╩═╩═╩═╝ ╚═╩═╩═╩═╝ ╚═╩═╩═╩═╝ ╚═╩═╩═╩═╝ ╚═╩═╩═╩═╝ │ ╚═╩═╩═╩═╝ ╚═╩═╩═╩═╝ ╚═╩═╩═╩═╝│╚═╩═╩═╩═╝│╚═╩═╩═╩═╝│╚═╩═╩═╩═╝│  │ │
      │ │ │                                                             │                              │         │         └─────────┘  │ │
      │ └─┼─────────────────────────────────────────────────────────────┼──────────────────────────────┼─────────┼──────────────────────┘ │
      │   │   ╔═╦═╗     ╔═╦═╗     ╔═╦═╗     ╔═╦═╗     ╔═╦═╗     ╔═╦═╗   │   ╔═╦═╗     ╔═╦═╗     ╔═╦═╗  │  ╔═╦═╗  │  ╔═╦═╗     ╔═╦═╗       │
      │   │   ╠═╬═╣     ╠═╬═╣     ╠═╬═╣     ╠═╬═╣     ╠═╬═╣     ╠═╬═╣   │   ╠═╬═╣     ╠═╬═╣     ╠═╬═╣  │  ╠═╬═╣  │  ╠═╬═╣     ╠═╬═╣       │
      │   │   ╚═╩═╝     ╚═╩═╝     ╚═╩═╝     ╚═╩═╝     ╚═╩═╝     ╚═╩═╝   │   ╚═╩═╝     ╚═╩═╝     ╚═╩═╝  │  ╚═╩═╝  │  ╚═╩═╝     ╚═╩═╝       │
      │   │                                                             │                              │         │                        │
      │   │                                                             │                              │         │                        │
      │   │    ╔═╗       ╔═╗       ╔═╗       ╔═╗       ╔═╗       ╔═╗    │    ╔═╗       ╔═╗       ╔═╗   │   ╔═╗   │   ╔═╗       ╔═╗        │
      │   │    ╚═╝       ╚═╝       ╚═╝       ╚═╝       ╚═╝       ╚═╝    │    ╚═╝       ╚═╝       ╚═╝   │   ╚═╝   │   ╚═╝       ╚═╝        │
      │   │                                                             │                              │         │                        │
      │   │                                                             │                              │         │                        │
      │   └─────────────────────────────────────────────────────────────┘ <┐                        ┌> └─────────┘                        │
      └────────────────────────────────────────────────────────────────────┼────────────────────────┼─────────────────────────────────────┘
                                                                           │                      ^ │
                                   [ "Mipmap"/"Mipmap Chain": usage depends on context;        ]  │ │
                                   [ can refer to a layer-face, all corresponding layer-faces, ] ─┴─┘
                                   [ an entire layer, or the entire texture.                   ]
    	
  • GL_TEXTURE_2D_MULTISAMPLE: 2D texture (non-array, multisampled, forbids mipmaps, 2D storage).
          [ ASCII art diagram, 2D multisample array texture     ]
          [ A 4x4 map; no mipmap since they are prohibited. ]
      ┌───────────────┐
      │ ┌───────────┐ ├─ "Texture", same as image, but without state
      │ │ ╔═╦═╦═╦═╗ │ │
      │ │ ╠═╬═╬═╬═╣ ├─┼─ "Image"
      │ │ ╠═╬═╬═╬═╣ │ │
      │ │ ╠═╬═╬═╬═╣ │ │
      │ │ ╚═╩═╩═╩═╝ │ │
      │ └───────────┘ │
      └───────────────┘
    	
  • GL_TEXTURE_2D_MULTISAMPLE_ARRAY: 2D texture (array, multisampled, forbids mipmaps, 3D storage (array of layers)).
          [ ASCII art diagram, 2D multisample array texture     ]
          [ Two 4x4 maps; no mipmaps since they are prohibited. ]
            ┌─ "Layer" / "Slice" of array, same as image.
      ┌─────┼───────────────────────────┐
      │   ┌─┴─────────┐                 ├─ "Texture"
      │ ┌─┼───────────┼───────────────┐ │
      │ │ │           │ ┌─ "Image" ─┐ │ │
      │ │ │ ╔═╦═╦═╦═╗ │ │ ╔═╦═╦═╦═╗ │ │ │
      │ │ │ ╠═╬═╬═╬═╣ │ │ ╠═╬═╬═╬═╣ │ ├─┼── "Image Array" /
      │ │ │ ╠═╬═╬═╬═╣ │ │ ╠═╬═╬═╬═╣ │ │ │   "Layered Image"
      │ │ │ ╠═╬═╬═╬═╣ │ │ ╠═╬═╬═╬═╣ │ │ │
      │ │ │ ╚═╩═╩═╩═╝ │ │ ╚═╩═╩═╩═╝ │ │ │
      │ │ │           │ └───────────┘ │ │
      │ └─┼───────────┼───────────────┘ │
      │   └───────────┘                 │
      └─────────────────────────────────┘
    	
  • GL_TEXTURE_BUFFER: 1D texture, buffer-backed storage
      No image available; texture buffers do not have pictorial semantics.
    	
    .

COMMENTS
Ian Mallett - Contact -
Donate
- 2018 - Creative Commons License