MedicalVisualization

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:

glTexImage2D(GL_TEXTURE_2D,    // 2D texture
             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 formatcomponents
GL_LUMINANCE1
GL_RGB3
GL_RGBA4
GL_ALPHA1
GL_LUMINANCE_ALPHA2


Texture data example for a checker board texture am Beispiel eines (gray value = luminance):

GLubyte checkerboard[8*8] =
   {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

Options: