GlBindTexture

From QB64 Phoenix Edition Wiki
Revision as of 06:05, 30 April 2022 by SMcNeill (talk | contribs) (Created page with "'''_glBindTexture:''' bind a named texture to a texturing target {{PageSyntax}} :: SUB '''_glBindTexture''' (BYVAL target AS _UNSIGNED LONG, BYVAL texture AS _UNSIGNED LONG) :: void '''_glBindTexture'''(GLenum {{Parameter|target}}, GLuint {{Parameter|texture}}); ; target : Specifies the target to which the texture is bound. Must be either {{KW|_GL_TEXTURE_1D}}, {{KW|_GL_TEXTURE_2D}}, {{KW|_GL_TEXTURE_3D}}, or {{KW|_GL_TEXTURE_1D_ARRAY}}, {{KW|_GL_TEXTURE_2D_ARRAY}},...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

_glBindTexture: bind a named texture to a texturing target


Syntax

SUB _glBindTexture (BYVAL target AS _UNSIGNED LONG, BYVAL texture AS _UNSIGNED LONG)
void _glBindTexture(GLenum target, GLuint texture);


target
Specifies the target to which the texture is bound. Must be either Template:KW, Template:KW, Template:KW, or Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, or Template:KW.
texture
Specifies the name of a texture.


Description

_glBindTexture lets you create or use a named texture. Calling _glBindTexture with target set to Template:KW, Template:KW, Template:KW, or Template:KW, Template:KW, Template:KW, Template:KW, Template:KW or Template:KW and texture set to the name of the new texture binds the texture name to the target. When a texture is bound to a target, the previous binding for that target is automatically broken.

Texture names are unsigned integers. The value zero is reserved to represent the default texture for each texture target. Texture names and the corresponding texture contents are local to the shared object space of the current GL rendering context; two rendering contexts share texture names only if they explicitly enable sharing between contexts through the appropriate GL windows interfaces functions.

You must use Template:KW to generate a set of new texture names.

When a texture is first bound, it assumes the specified target: A texture first bound to Template:KW becomes one-dimensional texture, a texture first bound to Template:KW becomes two-dimensional texture, a texture first bound to Template:KW becomes three-dimensional texture, a texture first bound to Template:KW becomes one-dimensional array texture, a texture first bound to Template:KW becomes two-dimensional arary texture, a texture first bound to Template:KW becomes rectangle texture, a, texture first bound to Template:KW becomes a cube-mapped texture, a texture first bound to Template:KW becomes a two-dimensional multisampled texture, and a texture first bound to Template:KW becomes a two-dimensional multisampled array texture. The state of a one-dimensional texture immediately after it is first bound is equivalent to the state of the default Template:KW at GL initialization, and similarly for the other texture types.

While a texture is bound, GL operations on the target to which it is bound affect the bound texture, and queries of the target to which it is bound return state from the bound texture. In effect, the texture targets become aliases for the textures currently bound to them, and the texture name zero refers to the default textures that were bound to them at initialization.

A texture binding created with _glBindTexture remains active until a different texture is bound to the same target, or until the bound texture is deleted with Template:KW.

Once created, a named texture may be re-bound to its same original target as often as needed. It is usually much faster to use _glBindTexture to bind an existing named texture to one of the texture targets than it is to reload the texture image using Template:KW, Template:KW, Template:KW or another similar function.


Template:PageNotes

The Template:KW and Template:KW targets are available only if the GL version is 3.2 or higher.


Template:PageErrors

Template:KW is generated if target is not one of the allowable values.

Template:KW is generated if target is not a name returned from a previous call to Template:KW.

Template:KW is generated if texture was previously created with a target that doesn't match that of target.


Template:PageUseWith

Template:KW with argument Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, or Template:KW.

See also

SUB _GL Template:KW, Template:KW, Template:KW, Template:KW, Template:KW, Template:KW


Template:PageCopyright