Texturdaten
← Texture Coordinates | ● | Texture Filtering →
From the OpenGL point of view, an image is a linear data chunk of 8- or 16-Bit RGB values stored sequentially in main memory. The first RGB value is the left top corner. Then the RFB values of the columns of the first row are specified, followed by the RGB values of all other rows (column first order).
A data chunk needs to be uploaded in texture memory of the graphics hardware with the following OpenGL command:
0, // level 0 (for mipmapping)
GL_RGB, // pixel format of texture
width,height, // texture size
0, // border size 0
GL_RGB, // pixel format of data supplied
GL_UNSIGNED_BYTE, // pixel storage type of data supplied
image); // pointer to data chunk
pixel format | components |
---|---|
GL_LUMINANCE | 1 |
GL_RGB | 3 |
GL_RGBA | 4 |
GL_ALPHA | 1 |
GL_LUMINANCE_ALPHA | 2 |
Texture data example for a checker board texture am Beispiel eines (gray value = luminance):
{255,0,255,0,255,0,255,0,
0,255,0,255,0,255,0,255,
255,0,255,0,255,0,255,0,
0,255,0,255,0,255,0,255,
255,0,255,0,255,0,255,0,
0,255,0,255,0,255,0,255,
255,0,255,0,255,0,255,0,
0,255,0,255,0,255,0,255};
Live Demo: 2D Checkerboard Texture (T#16)
← Texture Coordinates | ● | Texture Filtering →