Search code examples
c++openglglu

gluCylinder() and texture coordinates offset / multiplier?


How can i set the texture coordinate offset and multiplier for the gluCylinder() and gluDisk() etc. functions?

So if normally the texture would start at point 0, i would like to set it start at point 0.6 or 3.2 etc. by multiplier i mean the texture would either get bigger or smaller.

The solution cant be glScalef() because 1) im using normals, 2) i want to adjust the texture start position as well.


Solution

  • Try using the texture matrix stack:

    glMatrixMode(GL_TEXTURE);
    glLoadIdentity();
    glTranslatef(0.6f, 3.2f, 0.0f);
    glScalef(2.0f, 2.0f, 1.0f);
    glMatrixMode(GL_MODELVIEW);
    drawObject();