Updating a texture in OpenGL with glTexImage2D

后端 未结 1 422
忘掉有多难
忘掉有多难 2020-12-23 00:19

Are glTexImage2D and glTexSubImage2D the only ways to pass a buffer of pixels to a texture?

At the moment I use in a setup function glTexImage2D

相关标签:
1条回答
  • 2020-12-23 00:34

    In modern OpenGL there are 4 different methods to update 2D textures:

    1. glTexImage2D - the slowest one, recreates internal data structures.

    2. glTexSubImage2D - a bit faster, but can't change the parameters (size, pixel format) of the image.

    3. Render-to-texture with FBO - update texture entirely on GPU, very fast. Refer to this answer for more details: https://stackoverflow.com/a/10702468/1065190

    4. Pixel Buffer Object PBO - for fast uploads from CPU to GPU, not supported (yet) on OpenGL ES.

    0 讨论(0)
提交回复
热议问题