Overview
The texture system provides comprehensive support for loading textures from resources, creating procedural textures, managing cubemaps, and rendering to textures. It supports various filtering and wrapping modes for precise texture sampling control.Texture Types
Defines the type and purpose of a texture:
Color- Standard color/albedo textureSpecular- Specular intensity mapCubemap- Cubemap for skyboxes and reflectionsDepth- Depth buffer textureDepthCube- Cubemap depth textureNormal- Normal map for surface detailParallax- Height map for parallax mappingSSAONoise- Noise texture for SSAOSSAO- Screen-space ambient occlusion textureMetallic- Metallic property map (PBR)Roughness- Roughness property map (PBR)AO- Ambient occlusion mapHDR- High dynamic range texture
Texture Parameters
TextureWrappingMode
Determines how textures are sampled when coordinates fall outside [0, 1]:
Repeat- Repeats the texture infinitelyMirroredRepeat- Alternates texture direction on every repeatClampToEdge- Clamps coordinates to the edge, stretching edge pixelsClampToBorder- Uses a constant border color outside [0,1]
TextureFilteringMode
Determines texture sampling quality:
Nearest- Picks the closest texel (pixelated look)Linear- Linearly interpolates texels (smooth sampling)
TextureParameters
Wrapping mode for the horizontal (S/U) axis
Wrapping mode for the vertical (T/V) axis
Filter applied when the texture is minified (viewed from far away)
Filter applied when the texture is magnified (viewed up close)
Texture Class
Creating Textures
Creates a texture from a resource.Parameters:
resource- The resource from which to create the texturetype- The type of texture to create (default:TextureType::Color)params- Texture parameters for filtering and wrapping (default:{})borderColor- Border color when usingClampToBorderwrapping (default:{0, 0, 0, 0})
Creates a texture from a resource name.Parameters:
resourceName- The target resource’s nametype- The type of texture to create (default:TextureType::Color)params- Texture parameters (default:{})borderColor- Border color (default:{0, 0, 0, 0})
Procedural Textures
Creates a checkerboard pattern texture.Parameters:
width- Width of the texture in pixelsheight- Height of the texture in pixelscheckSize- Size of each checker squarecolor1- First checkerboard colorcolor2- Second checkerboard colorparams- Texture parameters (default:{})borderColor- Border color (default:{0, 0, 0, 0})
Creates a double-scale checkerboard texture with three colors.Parameters:
width- Width of the textureheight- Height of the texturecheckSizeBig- Size of larger checker squarescheckSizeSmall- Size of smaller checker squarescolor1- First colorcolor2- Second colorcolor3- Third colorparams- Texture parameters (default:{})borderColor- Border color (default:{0, 0, 0, 0})
Creates a tiled checkerboard texture with multiple tile patterns.Parameters:
width- Width of the textureheight- Height of the texturetiles- Vector of CheckerTile definitionsparams- Texture parameters (default:{})borderColor- Border color (default:{0, 0, 0, 0})
Creates a vertically stretched streak texture suited for rain particles.Parameters:
width- Width of the textureheight- Height of the textureparams- Texture parameters (default:{})borderColor- Border color (default:{0, 0, 0, 0})
Properties
Resource from which the texture was created. Empty for procedural textures.
Contains width, height, and channel information about the texture.
OpenGL texture ID.
The type of the texture.
Border color used when wrapping mode is set to
ClampToBorder.Cubemap
Cubemaps are used for skyboxes, environment mapping, and reflections.Creating Cubemaps
Creates a cubemap from a resource group containing exactly six face images.Parameters:
resourceGroup- Resource group with six resources in order: +X, -X, +Y, -Y, +Z, -Z
Creates a cubemap from six solid colors.Parameters:
colors- Array of 6 colors for each cubemap facesize- Resolution of each face
Methods
Updates the cubemap with new colors for each face.Parameters:
colors- Array of 6 colors
Properties
Resources for the six cubemap faces in order: +X, -X, +Y, -Y, +Z, -Z
Average color sampled across cubemap faces for ambient approximations.
Flag indicating whether averageColor contains sampled data.
RenderTarget
Render targets allow rendering scenes to textures for post-processing or use in materials.Constructor
Creates a new render target.Parameters:
window- The window in which the render target will be usedtype- Type of render target (default:RenderTargetType::Scene)resolution- Resolution in pixels (default:1024)
RenderTargetType
Scene- Standard scene render targetMultisampled- Anti-aliased render targetShadow- Shadow map render targetCubeShadow- Cubemap shadow mapGBuffer- G-buffer for deferred renderingSSAO- Screen-space ambient occlusion bufferSSAOBlur- Blurred SSAO buffer
Methods
Displays the render target in the window.Parameters:
window- The window to display inzindex- Z-index for display ordering (default:0)
Hides the render target from the window.
Shows the render target in the window.
Binds this render target’s framebuffer for rendering.
Binds a specific face of a cubemap render target.Parameters:
face- Face index (0-5: +X, -X, +Y, -Y, +Z, -Z)
Unbinds the framebuffer (binds the default framebuffer).
Resolves multisampled buffers to regular textures.
Adds a post-processing effect to the render target.Parameters:
effect- The effect to add
Returns the width of the render target in pixels.
Returns the height of the render target in pixels.
Properties
Primary output texture of the rendering process.
Depth information texture for depth-based effects.
Texture containing bright areas for bloom effects.
G-buffer texture for world-space positions (deferred rendering).
G-buffer texture for normals (deferred rendering).
G-buffer texture for albedo and specular intensity.
G-buffer texture for material properties.
Skybox
Skyboxes render cubemaps as scene backgrounds.Creating Skyboxes
Creates a skybox with a cubemap.Parameters:
cubemap- The cubemap texture to usewindow- The window in which to display
Methods
Displays the skybox in the window.Parameters:
window- The window to display in
Hides the skybox from the window.
Shows the skybox in the window.
Properties
The cubemap texture used for the skybox.