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: translation problem

  1. #1
    Intern Contributor
    Join Date
    Aug 2003
    Location
    singapore
    Posts
    87

    translation problem

    I drew a 3D rect with length from -x to x. and on top of this rect ( in the middle) i drew a smaller rect of length -(x-w)/2 to (x-w)/2 where w < or equal to x. I want to translate this smaller rect to the left till it reach the edge whereby the edges of both rect are aligned properly so i translate by

    glTranslatef ((-x-w)/2,0.0f,0.0f);

    but when w=x, by right there should be no small rect showing but i get one face at the edge. Other than that it is okie, can someone point out my mistake?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2002
    Location
    Silicon Valley
    Posts
    217

    Re: translation problem

    I don't understand the question. A screenshot would help.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Feb 2002
    Location
    Bonn, Germany
    Posts
    1,652

    Re: translation problem

    (-x-w) != -(x-w)

    Try this:
    glTranslatef(-(x-w)/2,0.0f,0.0f);

Posting Permissions

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