Changing the sprite.color will tint the image, but of course it tints
the entire image.  If your pieces are basically one color (like red
piece, blue piece, etc) then if you make your source image greyscale
or simply black, white, and transparent, then you can get nice
different colored sprites (and greyscale) simply by manipulating the
sprite.color.

Also in the line of what Alex suggested, you can have a 'hilite'
overlay sprite for the piece which you render on top of the sprite to
indicate selection.  This could simply be a transparent outline, and
again, you could render it in various tints.  And, if you want to
modify the color of a piece without modifying certain parts of it, you
could use a pair of sprites per piece - one containing the non-tinted
overlay, and one containing the parts you wish to vary the tint.

-price

On Sep 5, 8:05 pm, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
> On 9/6/08, dexters <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> >  Hello,
>
> >  does one of you know if it is possible to change the Hue/Color of a
> >  loaded image? I am asking for two reasons:
>
> >  1. For my multiplayer game I need basically the same image for all
> >  players with different colors. It would be nice if there would be a
> >  way of changing the color of an image dynamically, so I don't have to
> >  load one image per player.
>
> >  2. I would like to highlight images that are 'activatable' at a
> >  certaint point in time, by highlighting them (either changing color,
> >  making them brighter, changing other images to grayscale, ...).
>
> >  Does one of you have an idea on how to implement something like this?
>
> You can easily "tint" the colour of an image by changing the vertex
> colours.  The Sprite.color property is already set up to do this.
>
> Tinting won't make an image brighter, but you can get this effect by
> rendering the image on top of itself more than once, using a blend
> function of GL_SRC_ALPHA, GL_ONE.
>
> There's no render in greyscale.  If you're really keen, a fragment
> shader can be used to do it on the fly.  Alternatively, you can render
> your scene in colour in the first pass, then copy the framebuffer into
> a greyscale (GL_LUMINANCE) texture and blit that texture back to the
> framebuffer (possibly with some alpha so you can fade in and out of
> greyscale).  Neither of these tricks are particularly simple, and
> would require a little OpenGL knowledge.
>
> Alex.
--~--~---------~--~----~------------~-------~--~----~
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