I was fiddling with some textured tiles earlier, and I noticed a significant performance degradation when I increased the “clamp value” on the texture coordinates from 1.0 to a higher value (in my case it was raised to 30). In my test case, I was only drawing 9 large GL_QUADS, and wanted to tile a texture on these large quads so that the texture resolution was more appealing.
When I was clamping the texture coordinates to 1.0, i.e.,:
glTexCoord2f(0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);
I was getting ~ 70fps.
When the texture coordinates were clamped at a higher value of 30, i.e.:
glTexCoord2f(0.0f, 0.0f);
glTexCoord2f(30.0f, 0.0f);
glTexCoord2f(30.0f, 30.0f);
glTexCoord2f(0.0f, 30.0f);
I lost about 10 fps, and dropped down to 60fps.
I am pretty surprised that changing the texture coordinates on 9 quads would make such a difference in performance.
I was experimenting with possible work arounds for this problem I am seeing. I subdived each of the 9 quads that have high texture coordinates, leaving me with 36 quads now. The FPS dropped down about another 10 fps, which again seems rather drastic. To get back some fps, I lowered the texture coordinates back down:
glTexCoord2f(0.0f, 0.0f);
glTexCoord2f(15.0f, 0.0f);
glTexCoord2f(15.0f, 15.0f);
glTexCoord2f(0.0f, 15.0f);
This brought me to the same fps that I had if I was just using 1 quad with a higher texture coordinate value. So I decided to scrap that idea.
My second idea, was to double the size of the texture. So instead of using a 64x64 texture, i used a 128x128 texture. Once again, the bigger texture made a huge difference in my fps (lost about 10 fps).
What does this imply? Am I initally thinking that perhaps I am filling up my VRAM (i’m testing on an ATI RADEON 7500M 32MB gfx card)? Also worth mentioning: I am using RGBA tgas. I didn’t think that I was loading that many textures into memory, but I could be mistaken. If this is the problem, is there a way for me to see how much VRAM is available (either through code or with a free utility)?
I also noticed something weird: I tried to crank my texture coordinates up to something ridiculously high: 500.0f. This only dropped my fps down by 10. Whats more bizzare is that using a value of 1550.0f doesn’t seem to make a difference from using a value of 500.0f.
Also, I am having doubts that this is a problem with VRAM. I reduced the size of some of my textures, and it did not seem to make a difference.
Does anyone have a good explanation of this, or have any pointed questions that could lead me to a better understanding of why I am getting these results?