On Tue, Feb 16, 2010 at 5:41 PM, Mike Wyatt <[email protected]> wrote:
> I figured it out.  Pyglet doesn't restore the texture bound before the
> call to batch.draw().  Also, Lepton doesn't appear to bind texture(s)
> in each draw call.
>
> Saving and restoring the bound texture for each call to Pyglet fixes
> the rendering in my example script:
>
> @win.event
> def on_draw():
>        win.clear()
>        glLoadIdentity()
>
>        if drawSprite:
>                previousTexture = GLint()
>                glGetIntegerv( GL_TEXTURE_BINDING_2D, previousTexture )
>                batch.draw()
>                glBindTexture( GL_TEXTURE_2D, previousTexture.value )
>        default_system.draw()
>
> Thoughts on a better solution, or would this possibly be a good thing
> to patch into Pyglet and/or Lepton?

Before rendering in lepton the texturizer does this:

        glPushAttrib(GL_ENABLE_BIT);
        glEnable(GL_TEXTURE_2D);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, self->tex_filter);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, self->tex_filter);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, self->tex_wrap);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, self->tex_wrap);
        glBindTexture(GL_TEXTURE_2D, self->texture);

I'll try and figure out why the additional glBindTexture call makes a
difference. Maybe calling it before glTexParameteri is significant.

-Casey

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