I need to generate texture coordinates(using glTexGen) for a plane which is centered around the origin, that is it goes from -Width/2 to Width/2 in the x direction and from -Height/2 to Hgith/2 in the y direction. I don’t really know how to set up my s and t vectors to avoid getting negative texture coordinates.
Using this…
float sVec= {1/Width, 0, 0, 0};
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, sVec);
(and the same for t)
… will not work properly as half the coordinates become negative.
Maybe I’m just being stupid here, but how do I generate texture coordinates for objects with vertices with both negative and positive coordinates?