glTexImage2D on same texture with different size

Started by
3 comments, last by Brother Bob 14 years, 10 months ago
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?
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
Advertisement
yes
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
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)
"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
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).
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
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.

This topic is closed to new replies.

Advertisement