Skip to main content
gamedev.net
🔒 Locked

Update texture data

Started by zix99 Sep 15, 2005 at 2:32 PM 1 replies 5.8k views
Original Post
zix99
zix99
Hello everyone As much as this sounds like a beginners question, I'd like to ask before I corrupt something or other. What is the call to update an already created texture? For instance, I create a texture in my buffer, upload it using glTexImage2D.. is there some way to reupload data without glDeleteTextures() then reupload again? Thanks ~zix~
Kalidor
Kalidor
You can use glTexImage2D again, or if you want to change ONLY the data (ie: dimensions and internal format remain unchanged) you can use glTexSubImage2D. You can also use glTexSubImage2D, as the name implies, to alter just a sub-region of the texel data. Make sure you have the texture you want to change bound to the current texture unit.

EDIT: With glTexSubImage2D you also cannot change the border, so dimensions, internal format, and border remain unchanged.

EDIT2: And there are of course the 1D and 3D variants of glTexImage and glTexSubImage.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.