To offset all drawing at a certain point, you can use glTranslatef(x,
y, z), this changes the model/view matrix so that all subsequent
drawing is offset by the amount you specify. To crop the output you
can use glScissor. So before drawing your inner window you could do
something like:

glScissor(offset_x, offset_y, 800, 600)
glEnable(GL_SCISSOR_TEST)
glTranslatef(offset_x, offset_y, 0)

then when you are finished drawing the inner window:

glLoadIdentity()
glDisable(GL_SCISSOR_TEST)

to be able to draw on the whole pyglet window again.

hth,

-Casey

On Thu, Feb 11, 2010 at 2:39 AM, Philippe <[email protected]> wrote:
> Hello,
>
> I am new to pyglet.
> Here is my little issue.
>
> I draw sprites, animate them, ... it's great.
> Now, I would like to show only a part of what I display.
>
> I can simply change the size of the window. But, it will "crop" my
> scene from the (0, 0) origin.
> I like the fact that it crops without scaling anything, but I would
> like to crop from something different than (0, 0).
>
> I have a large scene of 1600x1200 (in a window of same size) and then
> wants to display a window of 800x600 of the middle of my scene (crop
> the scene to 800x600).
> Is it possible ?
> or do I have to shift the position of all my sprites ?
>
> thanks,
> Philippe
>
> --
> 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.
>
>

-- 
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