On Thu, Mar 26, 2009 at 4:25 AM, Alex Holkner <[email protected]> wrote:
>
> On Thu, Mar 26, 2009 at 10:05 PM, Tristam MacDonald
> <[email protected]> wrote:
>> On Thu, Mar 26, 2009 at 1: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.
>>
>> Internally, however (and you can see this if you write shaders) OpenGL
>> always treats colours as floats.
>
> By default framebuffers have 8 bits per colour per pixel, and the
> "floating point" representation you see in shaders is really a fixed
> point representation of that (0 bits before the decimal point, 8 bits
> after it).  Newer cards can give floating point buffers for
> compositing with HDR, but this is the exception.
>
> In reply to the earlier post asking if it would be better for pyglet
> to use the same colour format consistently -- yes it would.  The
> current setup (where pyglet.graphics uses unsigned bytes and
> everything else more or less uses floats) was a design mistake.  FWIW,
> using unsigned bytes for colour in vertex arrays gives a measurable
> performance benefit over floats (YMMV).

Of course pyglet could simply map floating point input values to their
corresponding unsigned byte values, to keep the performance benefit
without exposing that implementation detail. Certainly not convenient
to change in the b/w compatible way now though...

-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