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 6 of 6

Thread: how to calculate texture coordinate

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    7

    how to calculate texture coordinate

    How to calculate (s,t,r,w) coordinate in projective texture mapping?

    I have a projector model trasformation Mproj,
    ,a projection trasformation Pproj, and
    a matrix scale and bias T.
    T={1/2,0,0,1/2, 0,1/2,0,0, 0,0,1/2,0, 1/2,1/2,1/2,1} and M is the opengl modelview matrix.

    I use coordinate generation
    GLfloat eyePlaneS[] = { 1.0, 0.0, 0.0, 0.0 };
    GLfloat eyePlaneT[] = { 0.0, 1.0, 0.0, 0.0 };
    GLfloat eyePlaneR[] = { 0.0, 0.0, 1.0, 0.0 };
    GLfloat eyePlaneQ[] = { 0.0, 0.0, 0.0, 1.0 };
    and set GL_EYE_LINEAR.

    How opengl computes texture coordinate (s,t,r,q)
    for vertex v?
    What is the formula?

    I want only use glTexCoord4f to implement projective texture mapping.

    Thanks in advance.

    Ale.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    San Diego, CA, USA
    Posts
    604

    Re: how to calculate texture coordinate

    The answer to your question is in the OpenGL Red Book . Check out chapter 9 under "Automatic Texture-Coordinate Generation".

  3. #3
    Intern Newbie
    Join Date
    Jan 2004
    Location
    Keller, TX
    Posts
    42

    Re: how to calculate texture coordinate

    What you really should do is use a modeling program and export an asci text file format of your model. Then write a parser. I find the OBJ format easy to parse. You'll have everything you need.

  4. #4
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    7

    Re: how to calculate texture coordinate

    I read Automatic Texture-Coordinate Generation.
    My generated coordinate is p1'xe + p2'ye + p3'ze +p4'
    where (p1' p2' p3' p4') = (p1p2p3p4)M-1.
    But M-1 change during the program.What modelview matrix I must consider?

    Why in advance opengl demo "projtex.c" to move texture spot I need to multiply texture matrix by
    inverse trasformation texture?

    Ale.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    596

    Re: how to calculate texture coordinate

    you should consider the modelviewmatrix at the time you set the autogen planes.

  6. #6
    Junior Member Newbie
    Join Date
    Mar 2004
    Posts
    7

    Re: how to calculate texture coordinate

    [QUOTE]Originally posted by Mazy:
    [QB]you should consider the modelviewmatrix at the time you set the autogen planes

    Thanks Mazy.

    My original question was to perform texture coordinate in projective texture mapping.
    I read nvidia documentation and I found the formula:

    (s,t,r,q)=Te*(xe,ye,ze,we) where (xe,ye,ze,we) are the eye coordinates of the vertex.
    where Te=S*Pp*Vp*(Ve)-1.

    Well,S performs the scale and bias to map the s,t, and r components of the texture coordinate to the [0,1] range.Pp is projection matrix, Vp is view matrix for projector.(Ve)-1 is the inverse of camera.
    I don't understand what do (Ve)-1 in the formula.


    Now I move my texture spot in my scene by changing
    Vp.Another methods?

Posting Permissions

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