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. 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?" ;^)

Pyglet chooses unsigned bytes for labels probably because under the
covers it creates vertex lists to represent text and byte values are
commonly used for vertex lists. However the choice is arbitrary and
it's easy to see how some apis might use float values instead equally
arbitrarily, though it is not ideal.

Pyglet doesn't insulate you all that much from OpenGL itself, though
it does provide some extremely useful facilities for you. So, it would
be wise for you to pick up the OpenGL Red Book so you can figure out
what's really going on.

-Casey

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to