I have a texturemap with some text which I assign to a quad. After that I want to scale the quad but the text (in the texture) should remain the same. Is there some functions in OpenGL that allows you to do that or you have to recalculate the value “a” and “b” in glTexCoord2f(a, b).
exampel:
±-----+
| text |
±-----+
after scaling the quad the result should be:
±-----------+
| |
| text |
| |
±-----------+
If you scale the coordinates yourself, like glVertex3(xscale, yscale, zscale), then scale the texture cordinates in the same way, glTexCoord2(sscale, t*scale).
So, say you scale the quad with a factor two, do you want the text to be scaled aswell, with a factor two, or do you want the text to have the same size as on the original quad (and therefore cover less area of the quad)?
OK, then you must scale the texture matrix as I mentioned in my first post. I now think I forgot some things in my first post, so that’s you you didn’t get the result you wanted. You also need to translate the texture matrix to move the texture to the middle of the quad. I’m not entirely sure this is correct, but you should be able to get it working by tweaking the numbers. And you might have to call glScale before glTranslate, just swap the two lines.
Did some drawings on a paper, and it should move the texture to the middle of the quad, leaving the size unchanged.
Also remember to set wrapmodes to GL_CLAMP instead of GL_REPEAT.
And of course you can replace scale with scaleX/scaleY to scale the quad differently along the two axes. Just remember that the first scale in glScale is the same scale as the first scale in glTranslate.