Sign in to follow this  
Prune

glTexImage2D on same texture with different size

Recommended Posts

Can I assume the driver will deallocate the previous texture if I call glTexImage2D a second time on a texture (with a different size) without intervening glDeleteTextures and glGenTextures?

Share this post


Link to post
Share on other sites
Regardless of format changes etc.? Anyone know where it's in the spec? I'm looking over the spec but don't see where this is noted (glspec31.20090324.pdf)

Share this post


Link to post
Share on other sites
I don't know about the spec. It is just common knowledge.
glTexImage2D should cause a dellocation if size and format are not the same and realloc.

It is the same with all allocator functions such as glBufferData and glNewList(GL_COMPILE).

Share this post


Link to post
Share on other sites
Whether or not the internal data shall be released or not is not within the scope of the specification. It is an implementation detail how internal data is managed. The memory may, for example, be kept for future needs, so if it's not released it is kept for a reason. But just dumping any references to it within the implementation without releasing it is a memory leak, and I have enough confidence in the major driver developers to assume they're not leaking in such a common case.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this