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

Thread: transform trouble

  1. #1
    Guest

    transform trouble

    I have a function that draws an object

    void shape(void)
    {
    //set colour red
    glColor3f(1.0f, 0.0f, 0.0f);
    glRecti(111.25, 395, 141.25, 455);


    //set colour black
    glColor3f(0.0f, 0.0f, 0.0f);

    glRecti(141.25,395, 156.25,410);
    glRecti(141.25,440, 156.25,455);
    glRecti(96.25,395, 111.25,410);
    glRecti(96.25,440, 111.25,455);
    glEnd();

    glBegin(GL_LINES);

    glVertex2i(123.25, 400);
    glVertex2i(123.25, 415);
    glVertex2i(126.25, 400);
    glVertex2i(126.25, 415);
    glVertex2i(129.25, 400);
    glVertex2i(129.25, 415);

    glEnd();
    }

    I am wanting to transform this and have no idea how to do it. I have read through other posts and tried to follow advise through but am still stuggling can anybody help please

    Thanks
    Sax

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Chicago, IL US
    Posts
    100

    Re: transform trouble

    Are you permitted to use glTranslatef for this project?

  3. #3
    Guest

    Re: transform trouble

    Yes I can use glTranslatef

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: transform trouble

    If you want to transform a object without effecting others, then use glPushMatrix and glPopMatrix.

    // Draw object
    glPushMatrix() // Save Matrix
    glTranslate
    glRotate
    DrawObject_data_here
    glPopMatrix() // Restore Matrix to state before Save Matrix

Posting Permissions

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