Hello.  I'm sorry about the formatting of my last mail, I didn't
realize my client was set that way.

Here's the contents of that email:

Hello all, I'm confused about TextureGrid. I'm creating one from an
ImageGrid, and what I expect is that my image will be chopped into texture
tiles, so that each element in the TextureGrid is a quadrant of my image.
The image I'm using is 512x512. What I thought I would see was the
bottom-left 256x256 corner of the window matching the bottom-left 256x256 of
the image, while the rest of the window would be the black default clear
color.

I'm on python 2.6, vista, pyglet 1.1.3.

Here's a minimal version of the code:

import pyglet
from pyglet.gl import *

class MainWindow(pyglet.window.Window):
    def __init__(self, *args, **kwargs):
        pyglet.window.Window.__init__(self, *args, **kwargs)
        img = pyglet.image.load("small_background.png")
        self.grid = pyglet.image.ImageGrid(img, 2, 2)
        self.txgrid = self.grid.get_texture_sequence()

    def on_draw(self):
        verts = [0.0, 0.0, 256.0, 256.0]
        tex = self.txgrid[0, 0]
        glEnable(tex.target)

        glBindTexture(tex.target, tex.id)
        glBegin(GL_QUADS)

        glTexCoord2f(0.0, 0.0)
        glVertex3f(verts[0], verts[1], 0.5)

        glTexCoord2f(1.0, 0.0)
        glVertex3f(verts[2], verts[1], 0.5)

        glTexCoord2f(1.0, 1.0)
        glVertex3f(verts[2], verts[3], 0.5)

        glTexCoord2f(0.0, 1.0)
        glVertex3f(verts[0], verts[3], 0.5)

        glEnd()

if __name__ == '__main__':

    w = MainWindow(512, 512)
    pyglet.app.run()

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