Fra
Fra

Reputation: 423

OpenGL Texture Swapping

I have 4 texture handles created with glGenTextures(). Throughout the lifecycle of my application I am replacing the pixels associated with these handles via glTexImage2d(). Is there a formal way to 'replace' the pixels associated with a texture? Do I have to call glDeleteTextures() everytime?

Upvotes: 2

Views: 1408

Answers (1)

genpfault
genpfault

Reputation: 52084

You can call glTexImage2D() again if you want to replace the entire texture or glTexSubImage2D() if you want to replace a subset.

Or bind your texture to an FBO as a color attachment and render into some/all of it.

Upvotes: 3

Related Questions