TexturesGL 1.1

glGenTextures

Reserves names (IDs) for new texture objects.

Part of the family glGen*

Signature

void glGenTextures(GLsizei n, GLuint *textures);

How it works

Same pattern as glGenBuffers: you only get IDs. The texture becomes a real 2D (or cube, or 3D…) texture the first time it is bound to a target with glBindTexture.

Parameters

nGLsizei

How many IDs.

texturesGLuint *

Array receiving the IDs.

Example

example.cpp
1GLuint tex;
2glGenTextures(1, &tex);
3glBindTexture(GL_TEXTURE_2D, tex);
Official Khronos documentation