Current Situation
I have a spritesheet loaded in for a texture when drawing the specific portions of the sheet that I'd like to have on my quads I do some simple math to get their location on the sheet and normalize it.
My texture is setup like this:
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
The Problem
Where I'm facing the problem is that because I'm using a "chunk" of the total texture I can't take advantage of using 1.0 for the mapping of values to glTexCoordPointer
to cause the texture to stretch over the entire face.
Looked Into
I've looked for a glTexParameterf
option for scaling options but I failed to find anything.
Question
Is it possible with my current methods to stretch the texture over the face of the quad without having to load a separate image for every "sprite" of the texture? Or am I just doing everything completely wrong?
Picture that hopefully sort of clarifies:
Thanks for any help.
edit The problem was another issue all together: Turns out it was another issue all together, I thought this didn't make sense cause it was mapping it to the vertices so it should stretch regardless and infact it does work right I was assigning the wrong the width and height values to the drawing routines calculations. And now I feel really stupid, thanks for the help Byte56. Sorry for taking up your time. The GL_CLAMP solution would be the correct answer if I hadn't made a huge fail.
chunk
added on become x1 and y1. ThenGLfloat texture_coords[] = {x0, y0, x1, y0, x1, y1, x0, y1};
usingglTexCoordPointer
obviously. \$\endgroup\$ – dennmat Apr 24 '12 at 23:49