On 29 March 2010 06:31, George Oliver <[email protected]> wrote:
> I've tried giving the window a new on_resize, since as I understand it the
> default is just a 2D projection (which I think I don't want, I'm not sure),
> using this code from a nehe example:
>
> def resize(width, height):
>    if height==0:
>        height=1
>    glViewport(0, 0, width, height)
>    glMatrixMode(GL_PROJECTION)
>    glLoadIdentity()
>    gluPerspective(45, 1.0*width/height, 0.1, 100.0)
>    glMatrixMode(GL_MODELVIEW)
>    glLoadIdentity()
>
> I think this is basically what I want; from what I understand the
> gluPerspective call sets the perspective angle at 45 degrees. However
> setting this to the on_resize of the window then doesn't show my batch.

I think your batch may be clipped since pyglet renders it at z = 0 by
default, and your near clipping plane is at 0.1. Try translating
before drawing:

glPushMatrix()
glTranslatef(0.0, 0.0, 5.0)
// draw
glPopMatrix()

> In the same example the code also translates to z = -5.0, but doing the same
> thing in my code (without the new resize) also hides the batch. I'm guessing
> that's because of the default projection? However it doesn't seem to help to
> add the new resize.

Again, I think the batch is clipped, this time since pyglet's default
orthogonal projection has near and far clipping planes of -1 and 1. I
don't know why combining the translation with the resize code doesn't
work. Can you post a minimal but complete pyglet script that
reproduces the problem?

-- 
Mikael Lind
http://elemel.se/

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