Results 1 to 4 of 4

Thread: opengl texture coordinates values

  1. #1

    opengl texture coordinates values

    Another stupid question for you gurus

    using delphi, I use this instruction : gltexcoord2f(111/128, 21/12

    Despite to the fact values "111/128" and "21/128" are constants, are they evaluated every frame or only at build time ?

    thanks


  2. #2

    Re: opengl texture coordinates values

    If they are constants, they are calculated only once. But if not, they are every frame.

  3. #3

    Re: opengl texture coordinates values

    well that was my question.. I Wasn't so clear.

    in my mind "111/128" is constant, since the value never change.

    So, how does the compiler evaluate "111/128" ?

    In other words, what is stored at compilation time, is it 111/128 or 0.8671875 ?

    I use fractions to store texture coordinates, because it's more expressive to me (retrieve coordinate faster).
    I feel my app is very slow, that let me think that for every value, there is a division slowing the rendering process.

  4. #4

    Re: opengl texture coordinates values

    At compile time the compiler calculates the constant expression. So typing "111/128" or "0.8671875" will generate identical code. In other words there are no run-time penalties for using a constant expression.
    ZGameEditor - Develop 64kb games for Windows.
    Thrust for Vectrex - ROM-file and 6809 source code.

Bookmarks

Posting Permissions

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