As mentioned previously, the image
loader will typically load the image into RAM on the host computer
(client). However, to use the texture we
must pass it to the GPU (server). There
are several ways to do this.
level, internalFormat, width, height, border, format, type,
- level: 0 unless using mipmapping
specifies the colour components used internally by OpenGL on the GPU side
(GL_RGB, GL_RGBA, etc.)
- width, height:
size of the image – often a power of 2
width of border, typically 0
- format specifies
the colour components on the CPU side (GL_RGB, GL_RGBA, etc.)
- type defines the data type of the pixel data
- texels: pointer
to the client side image data.
that after calling glTexImage2D, the CPU side memory can be freed since the
texture will be loaded into VRAM.