I think I need a copy reference to buffer video, blit every game
object in this buffer an later, when the user change to a new
scene, show a gradual transition between 2 buffers (one to
last scene, and other to new scene).
So, there are any variant to image blit method with a destination
image parameter?, some like:
buffer = create_auxiliary_buffer()
alternative_blit(game_object_image, buffer, x, y)
buffer.blit(0, 0)
window.flip()
Note that i can't blit directly with double buffer driven by
pyglet, like:
image.blit(x, y)
window.flip()
because i want to show a transition effect with 2 scenes, and
i not find other way -- maybe this is my real problem :|
Thanks.
--
Hugo Ruscitti
www.losersjuegos.com.ar
You can do this using blending in OpenGL.
This basically covers what you want to do, but I think you'll need to
disable depth testing as you draw the second image.
http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial9.php#MixPicture
HTH
Thanks, I get a example program that works fine to create a blend transition:
-- %< --
from pyglet import window
from pyglet.window import key
from pyglet.image import load
from pyglet.gl import *
window = window.Window(width=640, height=480)
window.set_location(200, 200)
a = load('a.png')
b = load('b.png')
i = 1.0
while not window.has_exit:
window.dispatch_events()
b.blit(0, 0)
glEnable(GL_BLEND)
glDisable(GL_DEPTH_TEST)
if i > 0:
i -= 0.01
glColor4f(1, 1, 1, i)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
a.blit(0, 0)
glDisable(GL_BLEND)
window.flip()
-- %< --
But, I only can blend two images loaded from files. I can't draw any image
above ImageData instance.
I looking for something like:
>> player_imagedata.blit_in_a(background_or_buffer_imagedata, x, y)
in other words, blit in a auxiliary ImageData instance, not in a
backbuffer driven
by pyglet. It is possible?.
Thanks to all !.
--
Hugo Ruscitti
www.losersjuegos.com.ar