PDA

View Full Version : passing colors: using bytes vs. float



aphex
04-22-2001, 02:46 PM
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

jwatte
04-22-2001, 03:00 PM
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.

aphex
04-22-2001, 03:13 PM
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.

HFAFiend
04-22-2001, 03:40 PM
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.)

mcraighead
04-22-2001, 04:14 PM
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