Name
gl.TexImage -- specify a one- or two-dimensional texture image
Synopsis
gl.TexImage(level, internalformat, format, type, pixels[, border])
Function
This function does the same as gl.TexImage1D() and gl.TexImage2D() except that the pixel data is not passed in a raw memory buffer but as table containing one subtable for each row of pixels. This is of course not as efficient as using raw memory buffers because the table's pixel data has to be copied to a raw memory buffer first.

Width and height of the texture will be automatically determined by the layout of the table in pixels. If there is only one subtable within pixels, gl.TexImage() will define a texture of type #GL_TEXTURE_1D. If there are multiple subtables within pixels, #GL_TEXTURE_2D will be used.

Note that only #GL_FLOAT and #GL_UNSIGNED_BYTE are currently supported for type and internalformat only accepts #GL_RGB, #GL_RGBA, #GL_ALPHA, #GL_LUMINANCE, #GL_LUMINANCE_ALPHA, #GL_DEPTH_COMPONENT and the values 1, 2, 3, and 4.

See gl.TexImage2D for more details on the parameters accepted by this function.

Please consult an OpenGL reference manual for more information.

Inputs
level
specifies the level-of-detail number; level 0 is the base image level, level n is the nth mipmap reduction image
internalformat
specifies the number of color components in the texture; must be 1, 2, 3, or 4, or a symbolic constant (see above)
format
specifies the format of the pixel data (see above)
type
specifies the data type of the pixel data (see above)
pixels
specifies a two-dimensional table containing pixel data
border
optional: specifies the width of the border (defaults to 0)

Show TOC