Results 1 to 7 of 7

Thread: Get Coordinates of Transformed Geometry

  1. #1
    Senior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    150

    Get Coordinates of Transformed Geometry

    Get Coordinates of Transformed Geometry?

    Example:
    glPushMatrix();
    glRotatef(55,1.0,0.0,0.0);
    glBegin(GL_POINTS);
    glVertex3f(x,y,z);
    glEnd();
    glPopMatrix();
    So how can I get the Coordinates of my rotated vertex? is this possible or do i have to calculate the position myself (would be very slow)?

    thank you H.Stony

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jul 2001
    Location
    France
    Posts
    1,662

    Re: Get Coordinates of Transformed Geometry

    There are several other threads talking about that.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    150

    Re: Get Coordinates of Transformed Geometry

    sorry..i found nothing really useful
    i found something about "feedback mode". are there tutorials on it?

    thanks

  4. #4
    Junior Member Newbie
    Join Date
    Dec 2004
    Posts
    19

    Re: Get Coordinates of Transformed Geometry

    I'm not sure, but maybe if you multiply the coordinates of the vertex by the rotated modelview matrix...

  5. #5
    Senior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    150

    Re: Get Coordinates of Transformed Geometry

    that was also my first idea: which are the elements in the matrix to multiplicate? the last row? ....but
    i found a sgi example. in the example they use the feedback mode but i didn't find tutorials on it - only the example is hard to understand.

  6. #6
    Member Contributor
    Join Date
    Dec 2004
    Posts
    70

    Re: Get Coordinates of Transformed Geometry

    First retrieve the current modelview matrix:

    float mv[16];
    glGetFloatv(GL_MODELVIEW_MATRIX, mv);

    Then do the following to transform your vertex:

    float xp = mv[0] * x + mv[4] * y + mv[8] * z + mv[12];
    float yp = mv[1] * x + mv[5] * y + mv[9] * z + mv[13];
    float zp = mv[2] * x + mv[6] * y + mv[10] * z + mv[14];
    float wp = mv[3] * x + mv[7] * y + mv[11] * z + mv[15];

    xp /= wp;
    yp /= wp;
    zp /= wp;

    /A.B.

  7. #7
    Senior Member Regular Contributor
    Join Date
    Oct 2004
    Posts
    150

    Re: Get Coordinates of Transformed Geometry

    thank you

Similar Threads

  1. Confusion on model coordinates transformed to word coordinates
    By wangdingqiao in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-31-2014, 07:46 PM
  2. Get screen coordinates of a transformed point
    By alb84 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-10-2010, 09:37 AM
  3. retrieving transformed screen coordinates for 3d object
    By Ed Sanville in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-31-2005, 11:33 AM
  4. Obtaining coordinates of transformed vertex.
    By jojo555 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-23-2004, 12:32 AM
  5. read back transformed vertex coordinates...
    By ttdsuen in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-24-2004, 04:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean