To create a null image, call one of the texture creation functions, for example, glTexImage2D() with pixels set to the null pointer. The specified texture is created, but no pixels are processed. Using an uninitialized part of a texture yields undefined results.
The following code fragment creates a null image texture, then loads a subimage:
{ /* need to initialize "image" to something interesting */ static unsigned char image[32][32][4]; /* create a 256 x 256 null texture */ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5_EXT, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); /* load a 32 x 32 subimage starting at 100,110 */ glTexSubImage2DEXT(GL_TEXTURE_2D, 0, 100, 110, 32, 32, GL_RGBA, GL_UNSIGNED_BYTE, image); }