The glPrioritizeTextures function sets the residence priority of textures.

void glPrioritizeTextures(
  GLsizei n,
  GLuint *textures,
  const GLclampf *priorities


The number of textures to be prioritized.
A pointer to the first element of an array containing the names of the textures to be prioritized.
A pointer to the first element of an array containing the texture priorities. A priority given in an element of the priorities parameter applies to the texture named by the corresponding element of the textures parameter.


The glPrioritizeTextures function assigns the n texture priorities specified in the priorities parameter to the n textures named in the textures parameter. On computers with a limited amount of texture memory, OpenGL establishes a ``working set'' of textures that are resident in texture memory. These textures can be bound to a texture target much more efficiently than textures that are not resident.

By specifying a priority for each texture, the glPrioritizeTextures function enables you to determine which textures should be resident.

The texture priorities elements in priorities are clamped to the range [0.0, 1.0] before being assigned. Zero indicates the lowest priority; thus textures with priority zero are least likely to be resident. The value 1.0 indicates the highest priority; thus textures with priority 1.0 are most likely to be resident. However, textures are not guaranteed to be resident until they are bound.

The glPrioritizeTextures function ignores attempts to prioritize texture 0, or any texture name that does not correspond to an existing texture. None of the functions named by the textures parameter need to be bound to a texture target.

If a texture is currently bound, you can also use the glTexParameter function to set its priority. This is the only way to set the priority of a default texture.

You can include glPrioritizeTextures in display lists.

Note  The glPrioritizeTextures function is only available in OpenGL version 1.1 or later.

The following function retrieves the priority of a currently-bound texture related to glPrioritizeTextures:

glGetTexParameter with parameter name GL_TEXTURE_PRIORITY.

Error Codes

The following are the error codes generated and their conditions.

Error code Condition
GL_INVALID_VALUE n was a negative value.
GL_INVALID_OPERATION glPrioritizeTextures was called between a call to glBegin and the corresponding call to glEnd.


  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Gl.h.
  Library: Use Opengl32.lib.

See Also

glAreTexturesResident, glBegin, glEnd, glGetTexParameter, glTexImage1D, glTexImage2D, glTexParameter


Community Additions