AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
gl::Texture2DArray Class Referencefinal

Represents a 2D texture array. More...

#include <AUI/GL/Texture2DArray.h>

Detailed Description

A 2D texture array is a texture that contains multiple 2D textures, each accessible by its index. It's useful for storing and accessing multiple textures with the same dimensions.

After creating a 2D texture array, you can use update to update a single texture in the array. You cannot update dimensions of the texture array, so you should create a new one if you want to change the size of the texture array.

Constructor & Destructor Documentation

◆ Texture2DArray()

gl::Texture2DArray::Texture2DArray ( glm::uvec2 textureSize,
unsigned textureCount )
Parameters
textureSizeThe size of the 2D texture (width and height).
textureCountThe number of layers in the texture array.

This function allocates storage for a 2D texture array with the specified size and texture count. It binds the texture and uses glTexStorage3D to allocate the storage.

Member Function Documentation

> All members, including inherited

◆ update()

void gl::Texture2DArray::update ( unsigned texture,
AImageView image )
Parameters
textureThe index of the texture to be updated.
imageThe image to be used as the new texture.

This function binds the texture and uploads the provided image as a texture in the 2D texture array. It uses glTexSubImage3D to update the texture.

This function expects the image to have the same size as the texture size initialized earlier, otherwise, an assertion error is thrown.