I'm new to pyglet and to learn how it works I'm rewritting an old
image viewer I wrote with another graphic library.
So far I have the window drawing and keyboard detection to go from
image to image. However, I'm not seeing anywhere a stretch method or
something like that which I could use to make the image fit into the
window.
In my previous program I would load the image with PIL, rescale it and
then blit it. But how could I do this with OpenGL so that I can leave
the scaling to the video card/accelerator?
I saw something about projections in the contrib directory but didn't
understand too much of it. Is that the way to go?
If you're using blit(), you can pass in width and height keyword parameters:
http://pyglet.org/doc/api/pyglet.image.Texture-class.html#blit
If you're using sprites, use the scale property:
http://pyglet.org/doc/api/pyglet.sprite.Sprite-class.html#scale
Alex.
I'm still trying to figure out how to find information in those mazes
of little one liners each appended to individual methods overriden by
deep classes' hierarchies.
In hope of improving the situation a bit, please accept the attached
example to help future users.
This has been commented on several times on this list; check the
archives. In short: this behaviour is by design: pyglet iterates the
event loop after any event, whether or not it's handled, which by
default causes a redraw. You can use the Window.invalid flag to take
control of when redraws are made. The default situation will be
improved in pyglet 1.2.
Alex.
Sorry for being so bad at explaining. I was more interested in your
answer on providing examples for other people and to use these as
documentation helpers. If you are not, I won't bother to try and write
any more.