How does OpenGL read texures?

The title isn’t really that detailed, so I’ll go more into detail.

My question is, how does OpenGL read byte buffers that turn into the textures we see on screen, like what is the required structure of these buffers?

Many thanks, Carlos.

Refer to the documentation for glTexImage2D etc in the specification. The format is determined by a combination of the format and type parameters and the glPixelStore modes in effect at the time of the call.

The internal format is implementation-specific and undocumented. This is why you have functions to transfer data between buffers (in either system memory or video memory) and textures, and can’t just tell the implementation to use a block of memory as a texture. While the external format is invariably in raster-scan layout (row by row), the internal format will typically be something which is more cache-friendly, e.g. tiled or Hilbert-scan.

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.