So if the texture is to small for an object that is going to have that texture applied to it, what happens? does it grow in size to fit it or just not be applied at all or leave some parts of it not applied.
on the flip side:
If the texture is larger than the area it is going to be applied to it, then what happens? does it shrink or put the texture on till it covers it then leaves what ever texture is left off.
I seem to have problems with my whole program being covered in the texture rather than just the item being drawn.
If i bind a texture, like:
glVertexPointer(2, GL_FLOAT, 0, squareToBeDrawn);
glBindTexture(GL_TEXTURE_2D, textures[1]);
then do: glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
can i unbind the texture? Because everything not just this square is getting textured. Or am i making a mistake?
Will this draw the square with this texture and then if i unbind it, will all the next set of glDrawArrays() use the last glColor4f() that was used?
When you turn on texture mapping (or anything at all with glEnable or glEnableClientState, they stay on until you explicitly turn them off.
In your case, you don't want to "unbind" the texture to stop it being rendered on everything, just turn off GL_TEXTURE_2D until you need it again. If you just need a new texture, then call glBindTexture again, this time passing the new texture to use.
I am going to try it all out in about an hour and will let you know how i do.
But i was wondering if you could answer the top question please? What happens if the textures arn't the right size for the object that they will be applied for?
Also do i have to use: glTexCoordPointer(2, GL_SHORT, 0, squareTextureCoords); (taken from your tutorial)
I didn't understand how its cords are 0,0 0,1 1,0 or 1,1 for your squareTextureCoords
when your actual object that it would have to be applied to went from -1 to 1, not 0 to 1.
The reason i ask about textures not being the right size, is because my squares are 16x24 pixels (im pretty sure they are that size)
but have to be a factor of 2, so either 16x16 or 16x32 is allowed. But then the textures don't exactly match the square size.