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

Thread: passing colors: using bytes vs. float

  1. #1
    Intern Newbie
    Join Date
    Sep 2000
    Posts
    41

    passing colors: using bytes vs. float

    ok, so i'm passing my colors today using
    glcolor3f, so each color uses 3 floats, which is a lot of bandwidth. I've heard people using glcolor3ub to pass them as ubytes, which is more efficient for the bus. Does the card also optimize such case, or will performance be the same?

    thx

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    2,411

    Re: passing colors: using bytes vs. float

    If you just set the vertex color using immediate calls (glColor3f) I would assume the driver could convert to unsigned char before sending it on the bus. However, if you're using immediate calls, then bus bandwidth is unlikely to be your main bottleneck anyway.
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  3. #3
    Intern Newbie
    Join Date
    Sep 2000
    Posts
    41

    Re: passing colors: using bytes vs. float

    ok, really what i'm doing is usign the glcolor3f calls to create a display list which (supposedly) will be transferred to the server side (graphics card?) and executed locally, if i'm not wrong. Then, my question would be if the bunch of commands can be faster if, instead of using color3f, i use color3ub...
    sorry i wasn't very specific before...

    Originally posted by jwatte:
    If you just set the vertex color using immediate calls (glColor3f) I would assume the driver could convert to unsigned char before sending it on the bus. However, if you're using immediate calls, then bus bandwidth is unlikely to be your main bottleneck anyway.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Mar 2001
    Location
    USA
    Posts
    102

    Re: passing colors: using bytes vs. float

    I also wonder if you passed a color value that doesn't exactly corrospond to a 0-255 value if video cards keep track of the extra percision? (I remember someone saying that most cards hold extra internal percision for texturing.)

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Sep 2000
    Location
    Santa Clara, CA
    Posts
    1,096

    Re: passing colors: using bytes vs. float

    There are cases where specifying data as 3ub/4ub will indeed be faster. 3ub can actually sometimes be bad because of alignment issues, but that all depends.

    - Matt

Posting Permissions

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