I’m working on a glyph system, it only has 26 textured letters “glyphs”. The code only refers to these 26 textures. But after 128 textures are displayed per frame swap, it doesn’t display 129 or more.
Is there a maximum number of times you can perform a texture bind before each frame swap?
How do I work around that? Multipass somehow?
I suggest you post some code here as this is almost certainly some bug in your code. Have you tried using http://glintercept.nutty.org/ to get some XML frame dumps of your rendering?
Erm, no there is no such limit. It is probably something else in your code broken, that only shows up after 128 texture binds.
I hate simultaneous postings…
static GLuint texName;
for (unsigned int i = 0; i<spritecount.size();i++) //loop round building individual quad dimensions with textures referenced from a vector.
// ---modify images---
glScalef(xscale[i],yscale[i],0); // scale image
glRotatef(rotation[i],0.0,0.0,1.0); // rotate image
glRotatef(spin[i],0.0,1.0,0.0); // spin image
glRotatef(flip[i],1.0,0.0,0.0); // flip image
glBindTexture(GL_TEXTURE_2D, texName[spritecount[i]]); // gets a texture index from this vector, allows use of same texture for another quad.
zero_x = -(spriteWidth[i]/2);
zero_y = -(spriteHeight[i]/2);
one_x = -(spriteWidth[i]/2)+spriteWidth[i];
one_y = -(spriteHeight[i]/2)+spriteHeight[i];
glTexCoord2f(0.0, 0.0); glVertex2f(zero_x, zero_y);
glTexCoord2f(1.0, 0.0); glVertex2f(one_x, zero_y);
glTexCoord2f(1.0, 1.0); glVertex2f(one_x, one_y);
glTexCoord2f(0.0, 1.0); glVertex2f(zero_x, one_y);
I would say there’s nothing wrong with this code (except, that you really should put all your sprite’s data into a struct and then create a vector of structs, instead of n vectors).
I would assume that one of your many arrays isn’t up-to-date. Maybe spriteWidth or xscale or one of all those arrays is simply only 128 elements wide.
OR did you actually intend to index all the other arrays like your texName array? Like “xscale[spritecount[i]]” etc. ? Than that might be your problem.
Happy bug hunting,