Thanks!

This was actually exactly what I ended up doing.
Guess I'll just have to abandon the idea of pyglet sprites, and start 
learning some OpenGL :)


tirsdag den 26. juni 2018 kl. 13.08.47 UTC+2 skrev Neon22:
>
> Something like this but ran out of time to work the "blit_into" out and 
> set the gl blend correctly.
> Where the lightfile image is a soft edged circle (or whatever you need)
>
> def build_light(w,h, x,y, lightfile, dark=128):
>  """ build a rect with light to blend over a BG
>  - w,h are size of window, 
>  - x,y is position of the center of the light
>  - dark is dimming factor outside light spill
>  """
>  # create dim rectangle
>  bg_pattern = pyglet.image.SolidColorImagePattern((dark,dark,dark, 255))
>  img = pyglet.image.create(w,h, pattern=bg_pattern)
>  # add light
>  light = pyglet.image.load(lightfile)
>  light.anchor_x = img.width/2
>  light.anchor_y = img.height/2
>  # blit into img
>  #img.blit_into(light, x, y, 0)
>  light.blit_to_texture(img.get_texture, gl.GL_RGB, x, y,0)
>  return img
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to