glTexImage2D - change size of textures

Started by
2 comments, last by V-man 16 years, 10 months ago
In my simulation I may need to change the size of my textures *often*. Currently, what I do is if the size needs to change then: 1)delete texture 2)create it with glTexImage2D and re-load the new data onto it. The reason I do this is in case I frag the GPU memory. So my question is: if I don't delete the textures can I simply change the size of the textue using glTexImage2D and will the GPU handle all the memory usage issues? Or will it as I guessed result in messed up GPU memory. cheers
Advertisement
perhaps use Mip-maps, google is your friend. (I assume you want to build something like a level of detail)

cheers

sjoerd222
May the force be with... me! :-D
it's actually for GPGPU - so each texture is considered to be an array of data. These arrays change in size depending on the equations (fluid dynamics). They will change often. So back to my original question.
thanks anyhow
Yes, calling glTexImage2D is like "delete" and then "new" and it will slow things down if you do that every frame.

glTexSubImage2D is just for updating.

Or create many textures of whatever size you need or create one big texture.
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);

This topic is closed to new replies.

Advertisement