I have a function which is passed an x,y coordinate. This function calls glTexSubImage2D and updates the texture at texel x,y. I’d like to apply an offset to the coordinates. Is there a way to translate texel coordinates or do I have to handle this outside of opengl? At first I thought I could use
glMatrixMode(GL_TEXTURE)
glTranslatef()
but I got the impression it isn’t used for translating the parameters of glTexSubImage2D
but I got the impression it isn’t used for translating the parameters of glTexSubImage2D
You’re right; it doesn’t. Texture matrices transform texture coordinates only.
Really, can’t you just pass the offset directly to the function? Or, if code cleanliness is not important, can’t you store the offset in a global variable or something?
A texel translation would have been the cleanest solution. Overall, I have several functions like this, and I would have preferred that the code calling the functions and the functions themselves did not have to account for the offset.