Overview
Texture functions handle loading, unloading, and drawing textures and images. Textures are GPU-resident images optimized for rendering.Texture Loading
loadTexture
Loads texture from file into GPU memory (VRAM).Path to image file (supports .png, .jpg, .bmp, .tga, .gif, etc.)
Texture2D - Loaded texture
loadTextureFromImage
Loads texture from image data.Image to convert to texture
Texture2D - Loaded texture
isTextureValid
Checks if a texture is valid.Texture to check
Boolean - True if texture is valid
unloadTexture
Unloads texture from GPU memory.Texture to unload
Render Textures
loadRenderTexture
Loads a render texture for off-screen rendering.Render texture width
Render texture height
RenderTexture2D - Render texture
isRenderTextureValid
Checks if a render texture is valid.Render texture to check
Boolean - True if valid
unloadRenderTexture
Unloads render texture from GPU memory.Render texture to unload
Texture Drawing
drawTexture
Draws a texture at specified position.Texture to draw
X position
Y position
Tint color (use Color.White for no tint)
drawTextureV
Draws a texture with position defined by a Vector2.Texture to draw
Position vector
Tint color
drawTextureEx
Draws a texture with extended parameters.Texture to draw
Position vector
Rotation in degrees
Scale factor
Tint color
drawTextureRec
Draws a part of a texture (source rectangle).Texture to draw
Source rectangle within texture
Position to draw at
Tint color
drawTexturePro
Draws a texture with pro parameters (source, dest, origin, rotation).Texture to draw
Source rectangle
Destination rectangle
Rotation origin point
Rotation in degrees
Tint color
Texture Configuration
updateTexture
Updates GPU texture with new data.Texture to update
Pixel data
genTextureMipmaps
Generates GPU mipmaps for a texture.Texture to generate mipmaps for
setTextureFilter
Sets texture scaling filter mode.Texture to configure
Filter mode (0=POINT, 1=BILINEAR, 2=TRILINEAR, 3=ANISOTROPIC_4X, 4=ANISOTROPIC_8X, 5=ANISOTROPIC_16X)
setTextureWrap
Sets texture wrapping mode.Texture to configure
Wrap mode (0=REPEAT, 1=CLAMP, 2=MIRROR_REPEAT, 3=MIRROR_CLAMP)
Image Loading (CPU)
loadImage
Loads image from file into CPU memory (can be manipulated).Path to image file
Image - Loaded image
isImageValid
Checks if an image is valid.Image to check
Boolean - True if valid
unloadImage
Unloads image from CPU memory.Image to unload
Texture Properties
Texture2D.width
Gets the width of a texture. Returns:Number - Texture width in pixels
Texture2D.height
Gets the height of a texture. Returns:Number - Texture height in pixels
Best Practices
Always unload textures when done to free GPU memory: