On Thu, Mar 26, 2009 at 12:42 AM, Casey Duncan <[email protected]> wrote: > > On Wed, Mar 25, 2009 at 6:18 PM, Bruce Smith <[email protected]> wrote: >> >> On Mar 25, 7:49 am, Matthew Marshall <[email protected]> >> wrote: >>> All colors in rabbyt (and pyglet) are in the range 0..1. That's how >>> they are with OpenGL. You get used to it pretty quick :-) >> >> Actually, some pyglet colors are from 0..1 and others are from 0..255, >> depending on the API -- for example: > > The statement "that's how they are in OpenGL" isn't the whole truth. > In fact OpenGL lets you specify color values as bytes, short ints, > long ints or floats. The most popular of those options is bytes and > floats. The former for vertex lists because they are compact and the > latter for immediate mode. Though you can in fact use any > representation you choose for either. > > In the case of integer types, their most positive representation is > mapped to 1.0, and to further confuse the issue, it supports both > signed and unsigned integers of various sizes.
Yes, you can send the data as unsigned bytes, and the implementation might store them as unsigned bytes, but the range 0..1 is still how colors are worked with. You can't set the blend mode to GL_TWO_FIFTY_FIVE_MINUS_SRC. Lighting and fog work by multiplying colors. Etc. In my mind, colors in unsigned bytes are still 0..1, just stored in a tighter representation for practical implementation. But my mind's a strange place :-) > Thus the answer to the > question: "what is the range for color values in OpenGL", the true > answer is "it depends" or perhaps even "what range do you want to > use?" ;^) IMHO, answering "0..1" is still an accurate answer, and it's far more useful of an answer than "it depends". :-) MWM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
