Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Automatic texture coordinate generation

  1. #1
    Intern Contributor
    Join Date
    Apr 2002
    Posts
    85

    Automatic texture coordinate generation

    The redbook says that glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR)will make the texture move with the object. (I do this for GL_T also).

    So I am wondering how opengl knows how the object has transformed? Does this mean that any glTranslate, glRotate, glScale commands I do AFTER I enable with glEnable(GL_TEXTURE_GEN_S) are treated as the object transforming until I glDisable(GL_TEXTURE_GEN_S) it again?

    In other words, where do I put this in the code so it doesn't affect everything else?

    Thanks!
    P4 2Ghz, GEFORCE4, 512 Meg RAM, WIN2000, VStudio 6.0

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Automatic texture coordinate generation

    OpenGL uses the vertex after modelview transformation to generate texture coordinates. Do your modelview transformations as usual, and enable texture coordinate generation when needed.

  3. #3
    Intern Contributor
    Join Date
    Apr 2002
    Posts
    85

    Re: Automatic texture coordinate generation

    OK, I thought when I put GL_OBJECT_PLANE instead of GL_OBJECT_LINEAR, that meant that the plane was defined in world coordinates instead of the object's coordinates. I guess the plane is ALWAYS in local coordinates?

    So is this correct thinking then?...
    glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR) just tells opengl that I want to generate texture coordinates local to that object. And glTexGenfv(GL_S, GL_OBJECT_PLANE, plane) tells opengl that I want to use a plane which I specify.

    Thanks!
    P4 2Ghz, GEFORCE4, 512 Meg RAM, WIN2000, VStudio 6.0

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •