0
\$\begingroup\$

I want "texture2D(texture, vec2(0,0))" to fetch the pixel at the center of the texture and "texture2D(texture, vec2(-1,-1))" to fetch a pixel from the corner of the texture. I don't want to calculate from (-1,+1) to (0,+1) like s*.5+.5 I don't want that.

Is there some command that I can use to configure the hardware that way?

\$\endgroup\$
1

1 Answer 1

1
\$\begingroup\$

Not really.

In older, non-modern versions of OpenGL you can use glMatrixMode to activate the GL_TEXTURE matrix stack, and then push a scale and/or translation matrix that offsets accordingly. UV coordinates will be multiplied by the texture matrix prior to resolution.

But those functions are deprecated in modern OpenGL, because it's trivial to do them in a shader by offsetting the values you pass to texture2D directly. There is no facility to implicitly offset the texture origin in modern OpenGL.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .