0
votes
glDeleteTextures(total, &Item::texture[0]);
glGenTextures(total, &Item::texture[0]);

Iteration for all images, total;

glBindTexture( GL_TEXTURE_2D, Item::texture[i] );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits() );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

Tries to reload the textures, however it does not. Textures stay the same, unchanged. Any ideas how this could/should be handled? For clarity, I'm trying to reload a texture with a new one, preferably without changing the number of the texture (since there can be a lot of changes).

I'm working with Qt, C++. The code above is in a static function in a seperate GLwidget.

1
The interesting thing is that you always delete the texture at index 0 and generates a new one at the same index (0), but then you bind the texture at index i. Something smells funny..karlphillip
@karlphillip total is the count of textures and the second parameter the array start pointer. But why delete and recreate the textures again and again when just the data changes?Stefan Hanke
Mmm.. you might be right, gonna check that out.RobotRock
So how can I change the data in an other way than deleting and creating then?RobotRock
Any chance you're bound to the wrong rendering context, or no rendering context at all, when you're making these calls?Nathan Monteleone

1 Answers

3
votes

Any chance you're bound to the wrong rendering context, or no rendering context at all, when you're making these calls?