Results 1 to 3 of 3

Thread: individual segment

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2002
    Posts
    4

    individual segment

    hi, how can i make the segment rotate individually, if my segment code is as below:

    ....
    // *finger segment 2* //
    glTranslatef(0.15, -0.01, 0.0);
    glRotatef ((GLfloat) f2, 0.5, 0.0, 0.25);
    glTranslatef (0.25, 0.0, 0.0);
    glPushMatrix ();
    glScalef (1.0, 0.2, 0.5);
    glutWireCube (0.5);
    glPopMatrix ();

    // *fing_tumb* //
    glTranslatef(-0.65, -0.45, 0.0);
    glRotatef ((GLfloat) ft, 0.5, 0.0, 0.5);
    glTranslatef (0.25, 0.0, 0.0);
    glPushMatrix ();
    glScalef (1.0, 0.15, 0.5);
    glutWireCube(0.5);
    glPopMatrix ();

    ....
    ======
    well, my rotation is :

    ...
    case '1':
    f2 = (f2 - 90) % 180;
    glutPostRedisplay ();
    break;
    ....

    thanks.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    477

    Re: individual segment

    You forgot 2 "glPushMatrix()".


    glPushMatrix();
    // Your stuff
    glPopMatrix();

    glPushMatrix();
    // Your stuff
    glPopMatrix();

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    477

    Re: individual segment

    You need to put you "glTranslatef" inside the "glPush & glPop Matrix".

    ....
    // *finger segment 2* //
    glPushMatrix ();
    glTranslatef(0.15, -0.01, 0.0);
    glRotatef ((GLfloat) f2, 0.5, 0.0, 0.25);
    glTranslatef (0.25, 0.0, 0.0);
    glScalef (1.0, 0.2, 0.5);
    glutWireCube (0.5);
    glPopMatrix ();

    // *fing_tumb* //
    glPushMatrix ();
    glTranslatef(-0.65, -0.45, 0.0);
    glRotatef ((GLfloat) ft, 0.5, 0.0, 0.5);
    glTranslatef (0.25, 0.0, 0.0);
    glScalef (1.0, 0.15, 0.5);
    glutWireCube(0.5);
    glPopMatrix ();

Similar Threads

  1. Intersect triangle with segment
    By Yandersen in forum OpenGL: General
    Replies: 5
    Last Post: 08-29-2015, 04:36 PM
  2. Rotating individual objects
    By mountainoflight in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-21-2008, 07:10 AM
  3. Individual Triangles or Fan?
    By gordon1 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-22-2007, 02:03 AM
  4. Color individual pixels
    By Dogcow in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-03-2003, 09:42 AM
  5. f1 segment
    By opengluser in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 10-25-2002, 06:53 PM

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