Texture Best Practices

Here are some tips to ensure that you allow OpenGL to use your textures most efficiently, ensuring the best possible performance for your application. Some common pitfalls are enumerated here with some advice on how to avoid them.

Immutable Texture Storage

Use immutable texture storage for textures wherever possible. Immutable storage for textures is created using the glTexStorage2D() function or the appropriate one for your chosen texture target. Mutable storage is created by calling glTexImage2D(). When a texture is marked as immutable, the OpenGL implementation can make certain assumptions about the validity of a texture object. For example, the texture will always be complete.

Mipmaps

Create and initialize the mipmap ...

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.