I have a scenario where I need to change texture parameters and load a new data. Can I generate a texture id ( glGenTextures
) only once and then call for a user request the following code:
glBindTexture(GL_TEXTURE_2D, texId);
glTexImage2D(GL_TEXTURE_2D, 0, img.internalformat, img.width, img.height, 0, img.format, GL_UNSIGNED_BYTE, img.buf);
Should I delete and generate a new texture id before calling subsequent glTexImage2D ?
Yes! If i understood your question correctly you can call glDeleteTextures
, delete the texture and reuse the name. Here is more information:
https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glDeleteTextures.xml
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.