Maximum texture binds per bufferswap?

Hello,

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?

Thanks,

Cameron

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.

Jan.

I hate simultaneous postings…

static GLuint texName[256];

glGenTextures(256, texName);

for (unsigned int i = 0; i<spritecount.size();i++) //loop round building individual quad dimensions with textures referenced from a vector.
{

			glLoadIdentity();

			//	---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
			//		---

			glEnable(GL_ALPHA_TEST);
			glAlphaFunc(GL_GREATER, 0);
		
				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];

			glBegin(GL_QUADS);
			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);
			glEnd();

		}

glfwSwapBuffers();

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,
Jan.